{"record":{"id":"a822f3d6eb92f900","repo":"nats-io/nats-server","slug":"bad-pending-entry-sequence-d-out-of-range-a822f3","errorCode":null,"errorMessage":"bad pending entry, sequence [%d] out of range","messagePattern":"bad pending entry, sequence \\[(.+?)\\] out of range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/memstore.go","lineNumber":2776,"sourceCode":"\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 {\n\t\tredelivered = make(map[uint64]uint64, len(state.Redelivered))\n\t\tfor seq, dc := range state.Redelivered {\n\t\t\tredelivered[seq] = dc\n\t\t}\n\t}\n\n\t// Replace our state.\n\to.mu.Lock()\n\tdefer o.mu.Unlock()\n\n\t// Check to see if this is an outdated update.\n\tif state.Delivered.Consumer < o.state.Delivered.Consumer || state.AckFloor.Stream < o.state.AckFloor.Stream {\n\t\treturn ErrStoreOldUpdate\n\t}","sourceCodeStart":2758,"sourceCodeEnd":2794,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/memstore.go#L2758-L2794","documentation":"Sanity check while copying pending entries in consumerMemStore.Update: a pending-ack entry references a stream sequence at or below the AckFloor (or otherwise outside the valid range), meaning the state says a message is awaiting ack that should already have been acked.","triggerScenarios":"Thrown at server/memstore.go:2776 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Drop stale pending entries that fall below the AckFloor before calling Update","Rebuild the consumer state if pending and ack floor disagree persistently"],"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"}