nats-io/nats-server · error
Recovering sources state from index errored: %v
Error message
Recovering sources state from index errored: %v
What it means
A warning logged by recoverSourcesState() during stream recovery when reading the sources index file fails with an error other than not-exist (I/O or permission problem). Recovery proceeds without the persisted sources state, which is rebuilt in memory; mirror/source sequence continuity may be affected.
Source
Thrown at server/filestore.go:12480
buf = binary.AppendUvarint(buf, ss.Seq)
buf = binary.AppendUvarint(buf, uint64(len(ss.Ident)))
buf = append(buf, ss.Ident...)
}
fs.mu.RUnlock()
return fs.writeFileWithOptionalSync(fn, buf, defaultFilePerms)
}
// Lock should be held.
func (fs *fileStore) recoverSourcesState() uint64 {
// See if we have a sources index file.
fs.dios.acquire()
fn := fs.sourcesStatePath()
buf, err := os.ReadFile(fn)
fs.dios.release()
if err != nil && !os.IsNotExist(err) {
fs.warn("Recovering sources state from index errored: %v", err)
}
var sourcesSeq uint64
if err == nil {
sourcesSeq, err = fs.decodeSourcesState(buf)
if err != nil {
fs.warn("Error decoding sources state: %s", err)
// Remove the file, and reset collected state (if any).
_ = os.Remove(fn)
fs.sources = nil
}
}
if sourcesSeq < fs.state.FirstSeq {
sourcesSeq = fs.state.FirstSeq
}
return sourcesSeq
}View on GitHub (pinned to 3a66a489d2)
Solutions
- Inspect the wrapped OS error for permission or disk problems in the store directory
- Repair I/O issues and restart to recover sources state properly
- If the index file is corrupt, remove it and let the state rebuild
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at server/filestore.go:12480 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/b33a66322388f520.
Report an issue: GitHub.