{"record":{"id":"1225ae7a91ae9628","repo":"nats-io/nats-server","slug":"error-decoding-message-scheduling-state-s","errorCode":null,"errorMessage":"Error decoding message scheduling state: %s","messagePattern":"Error decoding message scheduling state: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/filestore.go","lineNumber":2499,"sourceCode":"func (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 {\n\t\tschedSeq = fs.state.FirstSeq\n\t}\n\treturn schedSeq\n}\n\n// Grabs last checksum for the named block file.\n// Takes into account encryption etc.\nfunc (mb *msgBlock) lastChecksum() []byte {\n\tf, err := mb.openBlock()\n\tif err != nil {","sourceCodeStart":2481,"sourceCodeEnd":2517,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/filestore.go#L2481-L2517","documentation":"A warning logged by recoverMsgSchedulingState() when the persisted message scheduling index file exists but its contents fail to decode (fs.scheduling.decode). The file is treated as unusable: recovery continues with scheduling state reset, and the index is effectively discarded rather than failing stream startup.","triggerScenarios":"Thrown at server/filestore.go:2499 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete the corrupt scheduling index file so it is regenerated from scratch","Check for disk corruption or unexpected writes to the JetStream store directory","Verify server version compatibility for the on-disk format"],"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-08T10:18:20.063Z"}