nats-io/nats-server · error · JSMirrorConsumerSetupFailedError
invalid consumer create response
Error message
invalid consumer create response
What it means
While (re)creating the mirror consumer, the response received on the reply subscription was not a valid consumer create response (malformed or unexpected payload), so mirror setup fails; the setup loop regenerates the subject and retries the request.
Source
Thrown at server/stream.go:4001
b, _ := json.Marshal(req)
// Regenerate subject since the previous name could've been included in it.
subject = generateSubject()
// Recreate the reply subscription so we don't get stale responses from other servers.
mset.unsubscribe(crSub)
if reply, respCh, crSub, err = newReplySubscription(); err != nil {
mirror.err = NewJSMirrorConsumerSetupFailedError(err, Unless(err))
retry = true
mset.mu.Unlock()
return
}
mset.outq.send(newJSPubMsg(subject, _EMPTY_, reply, nil, b, nil, 0))
mset.mu.Unlock()
goto SELECT
}
mset.unsubscribe(crSub)
cerr := ccr.Error
if cerr == nil {
cerr = NewJSMirrorConsumerSetupFailedError(errors.New("invalid consumer create response"))
}
mset.srv.Warnf("JetStream error response for create mirror consumer: %+v", cerr)
mirror.err = cerr
// Let's retry as soon as possible, but we are gated by sourceConsumerRetryThreshold
retry = true
mset.mu.Unlock()
return
}
// If using durable sourcing, we need the consumer to use acks based on flow control.
if durableDeliverSubject != _EMPTY_ && ccr.ConsumerInfo.Config.AckPolicy != AckFlowControl {
mset.unsubscribe(crSub)
mirror.err = NewJSMirrorConsumerRequiresAckFCError()
retry = true
mset.mu.Unlock()
return
}
View on GitHub (pinned to 3a66a489d2)
Solutions
- Check server logs and network between cluster peers for corrupted or stale replies
- Allow the automatic retry to succeed once the cluster is stable
- Restart or recreate the mirror stream if setup keeps failing
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at server/stream.go:4001 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/edf9dfc0b29cbe9a.
Report an issue: GitHub.