Channel closed by server: 406 (PRECONDITION-FAILED) with message "PRECONDITION_FAILED - inequivalent arg 'x-max-priority' for queue 'xyz'
Asked Answered
P

4

10

While running the app in consumer mode, my application is frequently crashing with an error Error: Channel closed by server: 406 (PRECONDITION-FAILED) with message "PRECONDITION_FAILED - inequivalent arg 'x-max-priority' for queue 'xyz' in vhost '/': received the value '10' of type 'byte' but current is none". Does anyone know the fix for this issue?

Pteridology answered 9/7, 2019 at 19:23 Comment(2)
What do you mean by "consumer mode"? The error you are seeing is not being sent by Node unless you have specifically written the server to require request preconditions and to return this error. Perhaps if you were to include the relevant source code, and identify the server you're trying to communication with, I might be able to help more.Czechoslovakia
Hey Rob, Sorry, for the delay in responding back. By "consumer mode" - I meant the RMQ consumer app. I was wondering why this was happening though I had x-max-priority: 10. Deleting the queue worked for me.Pteridology
P
9

@here Deleting the queue 'xyz' worked for me.

Pteridology answered 11/8, 2019 at 17:32 Comment(2)
How did you delete the queue?Euphonic
This is not really a solution so to say. I mean I have a dockerized app with RabbitMQ running in a container. But the app works just fine if I only run one of my tests (e2e tests) but will fail if I run all of them. I guess my case is different.Minnich
C
0

It appears that you're making a call to a server that requires one or more preconditions to be met before it will return a result. Since this is a remote server call, you'd need to check the API documentation to determine what precondition(s) is/are required, or if there is no API documentation, contact the manager of the server in question.

See 406 HTTP "Not Acceptable" Status Code for more about this particular error.

Czechoslovakia answered 11/7, 2019 at 22:13 Comment(1)
406 (PRECONDITION-FAILED) refers to an AMQP status rather than an HTTP status (which also has a different code "Not Acceptable")Guillerminaguillermo
H
0

While the exception of assertQueue still exists, but I found that I don't need to run assertqueue before consuming .. so for now I just commented the assertQueue call. and consuming is working.

I don't know why all examples of ameplib run assertQueue before anything?!

Hyphenate answered 9/9, 2020 at 20:18 Comment(1)
When RabbitMQ quits or crashes it will forget the queues and messages unless you tell it not to. So, it is important that we assert the queue before sending/consuming messages from a queue. To send/consume a message, we must declare a queue. Declaring a queue is idempotent - it will only be created if it doesn't exist already.Pteridology
P
0

406 ERROR also may occur if the queueNamed channel is acknowledeged more than once, Make sure channel ack type is set to manual, {noAck: false}. this closes the queueChannel which causes the consumer/publisher to not be able to access the queueChannel.

Note: Make sure you ack the queue in the same order it is received by the system. If your handling many publishers and consumers in single functionality also check if you have pre acked the channel.

Polychasium answered 21/9, 2022 at 20:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.