nats-io/nats-server · error

Resource not found: %v

Error message

Resource not found: %v

What it means

Inside setWriteErr, an incoming error matched os.IsNotExist. A missing file is treated as a recoverable condition: it is logged but does NOT latch werr or shut the node down, unlike critical write errors which disable the store and abort snapshotting.

Source

Thrown at server/raft.go:5470

	// Check if we are closed already.
	if n.State() == Closed {
		return
	}
	// Ignore if already set.
	if n.werr == err || err == nil {
		return
	}
	// Ignore non-write errors.
	if err == ErrStoreClosed ||
		err == ErrStoreEOF ||
		err == ErrStoreMsgNotFound ||
		err == errNoPending ||
		err == errPartialCache {
		return
	}
	// If this is a not found report but do not disable.
	if os.IsNotExist(err) {
		n.warn("Resource not found: %v", err)
		return
	}
	n.error("Critical write error: %v", err)
	n.werr = err
	// Abort any inflight async snapshot checkpoint.
	n.snapshotting = false
	n.shutdown()
	assert.Unreachable("Raft encountered write error", map[string]any{
		"n.accName": n.accName,
		"n.group":   n.group,
		"n.id":      n.id,
		"err":       err,
	})

	if isPermissionError(err) {
		go n.s.handleWritePermissionError()
	}

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Verify no external process is deleting files under the store directory
  2. If the missing file is a WAL/block, expect the normal recovery paths to rebuild or re-sync it
  3. No shutdown is triggered; monitor whether a critical write error follows
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/raft.go:5470 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/a45f77a928b46012. Report an issue: GitHub.