{"record":{"id":"edf9dfc0b29cbe9a","repo":"nats-io/nats-server","slug":"invalid-consumer-create-response","errorCode":null,"errorMessage":"invalid consumer create response","messagePattern":"invalid consumer create response","errorType":"error_code","errorClass":"JSMirrorConsumerSetupFailedError","httpStatus":null,"severity":"error","filePath":"server/stream.go","lineNumber":4001,"sourceCode":"\t\t\t\t\tb, _ := json.Marshal(req)\n\t\t\t\t\t// Regenerate subject since the previous name could've been included in it.\n\t\t\t\t\tsubject = generateSubject()\n\t\t\t\t\t// Recreate the reply subscription so we don't get stale responses from other servers.\n\t\t\t\t\tmset.unsubscribe(crSub)\n\t\t\t\t\tif reply, respCh, crSub, err = newReplySubscription(); err != nil {\n\t\t\t\t\t\tmirror.err = NewJSMirrorConsumerSetupFailedError(err, Unless(err))\n\t\t\t\t\t\tretry = true\n\t\t\t\t\t\tmset.mu.Unlock()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tmset.outq.send(newJSPubMsg(subject, _EMPTY_, reply, nil, b, nil, 0))\n\t\t\t\t\tmset.mu.Unlock()\n\t\t\t\t\tgoto SELECT\n\t\t\t\t}\n\t\t\t\tmset.unsubscribe(crSub)\n\t\t\t\tcerr := ccr.Error\n\t\t\t\tif cerr == nil {\n\t\t\t\t\tcerr = NewJSMirrorConsumerSetupFailedError(errors.New(\"invalid consumer create response\"))\n\t\t\t\t}\n\t\t\t\tmset.srv.Warnf(\"JetStream error response for create mirror consumer: %+v\", cerr)\n\t\t\t\tmirror.err = cerr\n\t\t\t\t// Let's retry as soon as possible, but we are gated by sourceConsumerRetryThreshold\n\t\t\t\tretry = true\n\t\t\t\tmset.mu.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If using durable sourcing, we need the consumer to use acks based on flow control.\n\t\t\tif durableDeliverSubject != _EMPTY_ && ccr.ConsumerInfo.Config.AckPolicy != AckFlowControl {\n\t\t\t\tmset.unsubscribe(crSub)\n\t\t\t\tmirror.err = NewJSMirrorConsumerRequiresAckFCError()\n\t\t\t\tretry = true\n\t\t\t\tmset.mu.Unlock()\n\t\t\t\treturn\n\t\t\t}\n","sourceCodeStart":3983,"sourceCodeEnd":4019,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/stream.go#L3983-L4019","documentation":"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.","triggerScenarios":"Thrown at server/stream.go:4001 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","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"}