nats-io/nats-server · error

Sourcing state is outdated; attempting to recover using line

Error message

Sourcing state is outdated; attempting to recover using linear scan (seq %d to %d)

What it means

On recovery, the per-source (mirror/import) tracking state is outdated relative to the stored messages. The store re-derives it by scanning the message range so source dedup/continuity decisions remain correct.

Source

Thrown at server/filestore.go:2352

	if sourcesRecover && !ttlRecover && !schedRecover {
		if fs.state.Msgs > 0 && sourcesSeq <= fs.state.LastSeq {
			fs.warn("Sourcing state is outdated; attempting to recover using backward scan (seq %d to %d)", sourcesSeq, fs.state.LastSeq)
			if err := fs.recoverSourcesBackwardScan(sourcesSeq, sourcesScan); err != nil {
				return err
			}
		}
		return nil
	}

	if fs.state.Msgs > 0 && scanSeq <= fs.state.LastSeq {
		if ttlRecover && ttlSeq <= fs.state.LastSeq {
			fs.warn("TTL state is outdated; attempting to recover using linear scan (seq %d to %d)", ttlSeq, fs.state.LastSeq)
		}
		if schedRecover && schedSeq <= fs.state.LastSeq {
			fs.warn("Message scheduling state is outdated; attempting to recover using linear scan (seq %d to %d)", schedSeq, fs.state.LastSeq)
		}
		if sourcesRecover && sourcesSeq <= fs.state.LastSeq {
			fs.warn("Sourcing state is outdated; attempting to recover using linear scan (seq %d to %d)", sourcesSeq, fs.state.LastSeq)
		}
		// Only consider sources that need recovering.
		update := func(iName string, sseq uint64, ident string) {
			if _, ok := sourcesScan[iName]; !ok {
				return
			}
			if sss, ok := fs.sources[iName]; ok {
				sss.Seq, sss.Ident = sseq, ident
			}
		}
		var (
			mb     *msgBlock
			sm     StoreMsg
			mblseq uint64
		)
		for seq := scanSeq; seq <= fs.state.LastSeq; seq++ {
		retry:
			if mb == nil {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. No action needed; the recovery scan repairs source state
  2. For source-only staleness a faster backward scan is used automatically
  3. Ensure clean shutdowns to minimize recovery scans
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server/filestore.go:2352 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/e84af257d503c337. Report an issue: GitHub.