PHP Fatal error: Uncaught exception ‘GearmanException’ with message ‘Failed to set exception option’

This cryptic message may seem rather out of place, but it usually has a very simple explaination; the Gearman server address you provided does not have a Gearman server running. Your Gearman server is down, or the address is wrong.

The reason why this is the error you’ll see is that the call to set the exception option depends on the connection being up.

There is however another possibility – if your libgearman is newer than your gearmand (which will lead to libgearman attempting to set the exception option, while gearmand has no idea what an exception option is), you’ll also receive this error. The fix is to make sure that you use the same version of libgearman as the gearmand you’re running, either by downgrading the gearman module / library you’re using, or (more sensible) by upgrading gearmand to the same version. This was the cause of the issue mentioned in the comments.

6 thoughts on “PHP Fatal error: Uncaught exception ‘GearmanException’ with message ‘Failed to set exception option’”

  1. And when it’s not a ‘usual’ case – what then? I’m getting this error, which kills the server, but the underlying problem, I have no idea. It’s somewhere in my worker code, but it would be neat to figure out where..

  2. This error can also occur if you’re using the default php example with $some_ver->addServer(); which will default to localhost, but for me on ubuntu 10.04 I had to turn that into addServer(“”); or else I was getting the same message.

  3. That might be caused by binding issues between ipv6 and ipv4; gearman might bind to the ipv4 interface, while the connection attempt happens on the ipv6 localhost interface.

  4. In my case the same exception is thrown when I echo something after calling $job->sendComplete($response);
    Any ideas why this may happen?..

  5. Im having issues with this error when I run 2 jobservers (failover) and addServers(, If both jobservers are up and running everything works well. If I take down one of the jobservers both client and worker fail, throwing exception “Uncaught exception ‘GearmanException’ with message ‘Failed to set exception option’”. I thought it was possible to use 2 jobservers as a failover solution? Am I doing something wrong?

Leave a Reply

Your email address will not be published. Required fields are marked *