{"record":{"id":"8b2d8e96522395dc","repo":"nats-io/nats-server","slug":"invalid-mirror-configuration","errorCode":null,"errorMessage":"invalid mirror configuration","messagePattern":"invalid mirror configuration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/stream.go","lineNumber":3729,"sourceCode":"\n// Setup our mirror consumer.\n// Lock should be held.\nfunc (mset *stream) setupMirrorConsumer() error {\n\tif mset.closed.Load() {\n\t\treturn errStreamClosed\n\t}\n\tif mset.outq == nil {\n\t\treturn errors.New(\"outq required\")\n\t}\n\t// We use to prevent update of a mirror configuration in cluster\n\t// mode but not in standalone. This is now fixed. However, without\n\t// rejecting the update, it could be that if the source stream was\n\t// removed and then later the mirrored stream config changed to\n\t// remove mirror configuration, this function would panic when\n\t// accessing mset.cfg.Mirror fields. Adding this protection in case\n\t// we allow in the future the mirror config to be changed (removed).\n\tif mset.cfg.Mirror == nil {\n\t\treturn errors.New(\"invalid mirror configuration\")\n\t}\n\n\t// If this is the first time\n\tif mset.mirror == nil {\n\t\tmset.mirror = &sourceInfo{name: mset.cfg.Mirror.Name}\n\t} else {\n\t\tmset.cancelSourceInfo(mset.mirror)\n\t\tmset.mirror.sseq = mset.lseq\n\t}\n\n\t// If we are no longer the leader stop trying.\n\tif !mset.isLeader() {\n\t\treturn nil\n\t}\n\n\tmirror := mset.mirror\n\n\t// We want to throttle here in terms of how fast we request new consumers,","sourceCodeStart":3711,"sourceCodeEnd":3747,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/stream.go#L3711-L3747","documentation":"setupMirrorConsumer found the stream's mirror configuration unusable — e.g. a mirror added on update after the source was removed, or required fields/outq missing — so the mirror consumer cannot be created. The guard prevents a panic on a stale or malformed mset.cfg.Mirror.","triggerScenarios":"Thrown at server/stream.go:3729 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Recreate the stream with a complete mirror configuration","Ensure the mirror source stream exists and its name is correct","Remove the mirror configuration if mirroring is no longer intended"],"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"}