{"record":{"id":"71e2150bdb6a0378","repo":"nats-io/nats-server","slug":"monitor-goroutine-not-running","errorCode":null,"errorMessage":"monitor goroutine not running","messagePattern":"monitor goroutine not running","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/jetstream_cluster.go","lineNumber":1063,"sourceCode":"\tcase node == nil:\n\t\treturn errors.New(\"group node missing\")\n\n\tcase msetNode == nil:\n\t\t// Can happen when the stream's node is not yet initialized.\n\t\treturn errors.New(\"stream node missing\")\n\n\tcase node != msetNode:\n\t\ts.Warnf(\"Detected stream cluster node skew '%s > %s'\", acc.GetName(), streamName)\n\t\treturn errors.New(\"cluster node skew detected\")\n\n\tcase nrgWerr != nil:\n\t\treturn fmt.Errorf(\"node write error: %v\", nrgWerr)\n\n\tcase streamWerr != nil:\n\t\treturn fmt.Errorf(\"stream write error: %v\", streamWerr)\n\n\tcase !mset.isMonitorRunning():\n\t\treturn errors.New(\"monitor goroutine not running\")\n\n\tcase mset.isCatchingUp():\n\t\treturn errors.New(\"stream catching up\")\n\n\tcase !node.Healthy():\n\t\treturn errors.New(\"group node unhealthy\")\n\n\tdefault:\n\t\treturn nil\n\t}\n}\n\n// isConsumerHealthy will determine if the consumer is up to date.\n// For R1 it will make sure the consunmer is present on this server.\nfunc (js *jetStream) isConsumerHealthy(mset *stream, consumer string, ca *consumerAssignment) error {\n\tjs.mu.RLock()\n\tif ca != nil && ca.unsupported != nil {\n\t\tjs.mu.RUnlock()","sourceCodeStart":1045,"sourceCodeEnd":1081,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/jetstream_cluster.go#L1045-L1081","documentation":"Returned by jetStream.isStreamHealthy when the stream's monitor goroutine (which watches the raft group and drives the replicated stream) is not running. The stream object exists and its node matches the assignment, but the background goroutine that keeps it in sync has not been started or has stopped, so the stream cannot be considered healthy.","triggerScenarios":"HEALTHCHECK during the startup window before monitorAndSync runs for the stream, or after the monitor goroutine exited due to an internal error/shutdown.","commonSituations":"Server still starting up and initializing replicated streams; health probes in Kubernetes firing before JetStream finishes initialization; stream state after an internal fault.","solutions":["Retry the health check; on startup this resolves once monitors start","Increase initial health-check delay / readiness probe grace period to cover JetStream init","If persistent, check server logs for stream monitor errors and restart the server"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"monitor goroutine not running\") {\n    // startup window; retry with backoff\n    time.Sleep(backoff)\n    return healthcheck()\n}","preventionTips":["Configure readiness probes with adequate initial delay for JetStream startup","Don't health-check a server mid-shutdown","Escalate to alerting only if the error persists across multiple retries"],"tags":["jetstream","healthcheck","startup","goroutine"],"backgroundTag":"jetstream-monitor-not-running","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}