{"record":{"id":"5ef77c86be261152","repo":"nats-io/nats-server","slug":"stream-not-found","errorCode":null,"errorMessage":"stream not found","messagePattern":"stream not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/jetstream_cluster.go","lineNumber":1029,"sourceCode":"\t\tjs.mu.RUnlock()\n\t\treturn errors.New(\"stream assignment or group missing\")\n\t}\n\t// Surface any persisted assignment-level error (e.g. failed create on this\n\t// peer due to account limits) so the health check reflects the broken state\n\t// instead of falling through to runtime-only checks.\n\tif sa.err != nil {\n\t\terr := sa.err\n\t\tjs.mu.RUnlock()\n\t\treturn fmt.Errorf(\"stream assignment error: %w\", err)\n\t}\n\tstreamName := sa.Config.Name\n\tnode := sa.Group.node\n\tjs.mu.RUnlock()\n\n\t// First lookup stream and make sure its there.\n\tmset, err := acc.lookupStream(streamName)\n\tif err != nil {\n\t\treturn errors.New(\"stream not found\")\n\t}\n\n\tmsetNode := mset.raftNode()\n\tmset.cfgMu.RLock()\n\treplicas := mset.cfg.Replicas\n\tmset.cfgMu.RUnlock()\n\tvar nrgWerr error\n\tif node != nil {\n\t\tnrgWerr = node.GetWriteErr()\n\t}\n\tstreamWerr := mset.getWriteErr()\n\tswitch {\n\tcase replicas <= 1:\n\t\treturn nil // No further checks for R=1 streams\n\n\tcase node == nil:\n\t\treturn errors.New(\"group node missing\")\n","sourceCodeStart":1011,"sourceCodeEnd":1047,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/jetstream_cluster.go#L1011-L1047","documentation":"Returned by jetStream.isStreamHealthy when acc.lookupStream(streamName) fails during a health check: the assignment says the stream should exist on this server, but the account has no such stream materialized locally. The meta-level assignment and the local stream state are out of sync.","triggerScenarios":"HEALTHCHECK runs on a peer before the stream create has been applied locally, after local stream deletion, or on a peer that failed/dropped the stream while the meta assignment still lists it.","commonSituations":"Server still catching up after a restart; stream creation failed on this peer (e.g. account limits) but the assignment remains; timing window during clustered stream creation or removal.","solutions":["Check whether the stream exists via $JS.API.STREAM.INFO.<stream> and on this server via jsz","Allow time for the stream create to replicate, then re-run the health check","If the assignment is stale (stream deleted), verify the meta group has processed the deletion; restart the server if the state is permanently inconsistent"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before health-checking, confirm the stream exists\nresp, err := nc.Request(fmt.Sprintf(\"$JS.API.STREAM.INFO.%s\", stream), nil, 5*time.Second)\nstreamExists := err == nil // else the stream truly isn't materialized yet","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"stream not found\") {\n    // re-check STREAM.INFO; if it now exists, the earlier failure was replication lag\n    time.Sleep(backoff)\n    return healthcheck()\n}","preventionTips":["Gate health checks on a successful STREAM.INFO call","Wait for stream creation to replicate to all peers before probing","Watch for account-limit failures on individual peers that leave assignments without streams"],"tags":["jetstream","clustering","healthcheck"],"backgroundTag":"jetstream-stream-not-found","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}