{"record":{"id":"5434a7805f1b5b74","repo":"nats-io/nats-server","slug":"recovering-message-scheduling-state-from-index-err","errorCode":null,"errorMessage":"Recovering message scheduling state from index errored: %v","messagePattern":"Recovering message scheduling state from index errored: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/filestore.go","lineNumber":2489,"sourceCode":"\t\t}\n\t}\n\n\tif ttlseq < fs.state.FirstSeq {\n\t\tttlseq = fs.state.FirstSeq\n\t}\n\treturn ttlseq\n}\n\n// Lock should be held.\nfunc (fs *fileStore) recoverMsgSchedulingState() uint64 {\n\t// See if we have a schedule index file.\n\tfs.dios.acquire()\n\tfn := filepath.Join(fs.fcfg.StoreDir, msgDir, msgSchedulingStreamStateFile)\n\tbuf, err := os.ReadFile(fn)\n\tfs.dios.release()\n\n\tif err != nil && !os.IsNotExist(err) {\n\t\tfs.warn(\"Recovering message scheduling state from index errored: %v\", err)\n\t}\n\n\tfs.scheduling = newMsgScheduling(fs.runMsgScheduling)\n\tfs.scheduling.paused = fs.recovering\n\n\tvar schedSeq uint64\n\tif err == nil {\n\t\tschedSeq, err = fs.scheduling.decode(buf)\n\t\tif err != nil {\n\t\t\tfs.warn(\"Error decoding message scheduling state: %s\", err)\n\t\t\t// Remove the file, and reset collected state (if any).\n\t\t\t_ = os.Remove(fn)\n\t\t\tfs.scheduling = newMsgScheduling(fs.runMsgScheduling)\n\t\t\tfs.scheduling.paused = fs.recovering\n\t\t}\n\t}\n\n\tif schedSeq < fs.state.FirstSeq {","sourceCodeStart":2471,"sourceCodeEnd":2507,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/filestore.go#L2471-L2507","documentation":"A warning logged (not returned) by recoverMsgSchedulingState() during stream recovery when reading the message scheduling index file fails with an error other than not-exist (e.g. I/O or permission error). The store continues recovery without the persisted scheduling state, falling back to rebuilding it in memory; the sequence state may be less precise.","triggerScenarios":"Thrown at server/filestore.go:2489 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped OS error for disk or permission problems on the stream's store directory","Fix underlying I/O issues and restart the server to recover scheduling state correctly","If the index file is corrupt, remove it; the scheduling state will be rebuilt"],"exampleFix":null,"handlingStrategy":"fallback","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"}