{"record":{"id":"c2115bdb39658639","repo":"nats-io/nats-server","slug":"bad-ack-floor-for-consumer-c2115b","errorCode":null,"errorMessage":"bad ack floor for consumer","messagePattern":"bad ack floor for consumer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/memstore.go","lineNumber":2762,"sourceCode":"\t}\n\tlseq := ms.state.LastSeq\n\tfor _, db := range dbs {\n\t\t// Skip if beyond our current state.\n\t\tif first, _, _ := db.State(); first > lseq {\n\t\t\tcontinue\n\t\t}\n\t\tdb.Range(func(seq uint64) bool {\n\t\t\tms.removeMsg(seq, false)\n\t\t\treturn true\n\t\t})\n\t}\n\treturn nil\n}\n\nfunc (o *consumerMemStore) Update(state *ConsumerState) error {\n\t// Sanity checks.\n\tif state.AckFloor.Consumer > state.Delivered.Consumer {\n\t\treturn fmt.Errorf(\"bad ack floor for consumer\")\n\t}\n\tif state.AckFloor.Stream > state.Delivered.Stream {\n\t\treturn fmt.Errorf(\"bad ack floor for stream\")\n\t}\n\n\t// Copy to our state.\n\tvar pending map[uint64]*Pending\n\tvar redelivered map[uint64]uint64\n\tif len(state.Pending) > 0 {\n\t\tpending = make(map[uint64]*Pending, len(state.Pending))\n\t\tfor seq, p := range state.Pending {\n\t\t\tpending[seq] = &Pending{p.Sequence, p.Timestamp}\n\t\t\tif seq <= state.AckFloor.Stream || seq > state.Delivered.Stream {\n\t\t\t\treturn fmt.Errorf(\"bad pending entry, sequence [%d] out of range\", seq)\n\t\t\t}\n\t\t}\n\t}\n\tif len(state.Redelivered) > 0 {","sourceCodeStart":2744,"sourceCodeEnd":2780,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/memstore.go#L2744-L2780","documentation":"Sanity check in consumerMemStore.Update: the reported consumer-sequence AckFloor exceeds the Delivered consumer sequence, which is impossible in a consistent state (more messages acknowledged than delivered). It guards against persisting a corrupted or forged ConsumerState.","triggerScenarios":"Thrown at server/memstore.go:2762 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the consumer state being pushed (usually from replication or a state update API) for a bogus AckFloor","Reset or recreate the consumer if its state is irrecoverably inconsistent"],"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-08T10:18:20.063Z"}