Geoff Garbers

Husband. Programmer. Tinkerer.

Laravel AMQP Queues: Server channel error -1

Oct 25, 2019

I have recently been making use of Laravel’s queues using the enqueue/laravel-queue package, with the enqueue/amqp-ext transport. This has proven to be very easy to work with and to implement.

However, in one of my queue jobs, I noticed that whenever I had a job that failed more than once, I’d receive the following error message:

Server channel error: -1, message: unexpected response

It turns out that this was because I was manually failing a job incorrectly - by calling $this->fail() followed by $this->delete().

The solution to getting rid of this error is to either call $this->fail() or $this->delete() on the job - you cannot call both and have it work correctly.