{"record":{"id":"7aaf8b3a254b4c01","repo":"nats-io/nats-server","slug":"max-ack-pending-for-all-consumers-would-be-v-whic","errorCode":null,"errorMessage":"max_ack_pending for all consumers would be %v which exceeds the limit of %v","messagePattern":"max_ack_pending for all consumers would be (.+?) which exceeds the limit of (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mqtt.go","lineNumber":5819,"sourceCode":"\tackWait := opts.MQTT.AckWait\n\tif ackWait == 0 {\n\t\tackWait = mqttDefaultAckWait\n\t}\n\tmaxAckPending := int(opts.MQTT.MaxAckPending)\n\tif maxAckPending == 0 {\n\t\tmaxAckPending = mqttDefaultMaxAckPending\n\t}\n\n\tsess.mu.Lock()\n\tpubRelSubject := sess.pubRelSubject\n\ttmaxack := sess.tmaxack\n\tidHash := sess.idHash\n\tid := sess.id\n\tsess.mu.Unlock()\n\n\t// Check that the limit of subs' maxAckPending are not going over the limit\n\tif after := tmaxack + maxAckPending; after > mqttMaxAckTotalLimit {\n\t\treturn fmt.Errorf(\"max_ack_pending for all consumers would be %v which exceeds the limit of %v\",\n\t\t\tafter, mqttMaxAckTotalLimit)\n\t}\n\n\tccr := &CreateConsumerRequest{\n\t\tStream: mqttOutStreamName,\n\t\tConfig: ConsumerConfig{\n\t\t\tDeliverSubject: pubRelDeliverySubject,\n\t\t\tDurable:        mqttPubRelConsumerDurablePrefix + idHash,\n\t\t\tAckPolicy:      AckExplicit,\n\t\t\tDeliverPolicy:  DeliverNew,\n\t\t\tFilterSubject:  pubRelSubject,\n\t\t\tAckWait:        ackWait,\n\t\t\tMaxAckPending:  maxAckPending,\n\t\t\tMemoryStorage:  opts.MQTT.ConsumerMemoryStorage,\n\t\t},\n\t}\n\tif opts.MQTT.ConsumerInactiveThreshold > 0 {\n\t\tccr.Config.InactiveThreshold = opts.MQTT.ConsumerInactiveThreshold","sourceCodeStart":5801,"sourceCodeEnd":5837,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/mqtt.go#L5801-L5837","documentation":"MQTT consumer-creation check: adding this subscription's maxAckPending to the session-wide running total (tmaxack) would exceed mqttMaxAckTotalLimit. It protects the server from one MQTT session fanning out more in-flight unacked messages than the global cap allows.","triggerScenarios":"Thrown at server/mqtt.go:5819 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Lower the consumer's MaxAckPending setting","Unsubscribe unused consumers to release their share of the total budget","Split sessions if the workload legitimately needs more pending acks"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}