nats-io/nats-server · error
failed to get consumer state for '%s > %s'
Error message
failed to get consumer state for '%s > %s'
What it means
Emitted during a clustered stream snapshot when the internal $JS.API.CLUSTER.CONSUMER.INFO request to a peer replica returns an error or a nil ConsumerInfo for a consumer that has a RAFT assignment. The 'stream > consumer' names identify which assignment's state could not be fetched, so the snapshot cannot capture that consumer's delivered/ack floors.
Source
Thrown at server/stream_backup.go:193
AckFloor: SequencePair{
Consumer: ci.AckFloor.Consumer,
Stream: ci.AckFloor.Stream,
},
}
if ci.NumAckPending > 0 {
// Cluster consumer info does not include the sparse pending state.
// Roll back to the ack floor so all possibly unacknowledged messages
// are delivered again instead of guessing which ones are pending.
state.Delivered = state.AckFloor
}
return state
}
if clustered {
for _, ca := range consumerAssignments {
ci, err := sysRequest[ConsumerInfo](js.srv, clusterConsumerInfoT, sa.Client.serviceAccount(), sa.Config.Name, ca.Name)
if err != nil || ci == nil {
errCh <- fmt.Errorf("failed to get consumer state for '%s > %s'", sa.Config.Name, ca.Name)
return
}
if err := writeConsumerMsg(SnapshotConsumerState{
ConsumerConfig: ca.Config,
ConsumerState: consumerStateFromInfo(ci),
}); err != nil {
errCh <- err
return
}
}
} else {
for _, o := range consumerStores {
config := o.GetConfig()
state, err := o.State()
if err != nil {
errCh <- fmt.Errorf("couldn't load consumer '%s' state: %s", config.Name, err)
return
}View on GitHub (pinned to 3a66a489d2)
Solutions
- Check JetStream cluster health and consumer replica assignments (stream and consumer RAFT leaders) before starting the snapshot
- Retry the snapshot after the cluster settles; transient leadership changes can make the internal sysRequest fail
- Verify the consumer still exists on the expected peer and that the account has the correct permissions for the internal service request
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at server/stream_backup.go:193 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/03df8efe9096b972.
Report an issue: GitHub.