nats-io/nats-server · error

Partial cache: offset slot index %d is greater than index le

Error message

Partial cache: offset slot index %d is greater than index len %d

What it means

A warning logged by msgBlock.slotInfo() when the requested slot index is beyond the partial cache's index length. The sequence maps to a slot outside the currently cached range, so the lookup cannot be served and errPartialCache is returned, prompting the caller to fall back to loading the full block.

Source

Thrown at server/filestore.go:6615

	if wasLoaded {
		if err := mb.loadMsgsWithLock(); err != nil {
			return err
		}
	}
	return nil
}

// Grab info from a slot.
// Lock should be held.
func (mb *msgBlock) slotInfo(slot int) (uint32, uint32, bool, error) {
	switch {
	case mb.cache == nil: // Shouldn't be possible, but check it anyway.
		return 0, 0, false, errNoCache
	case slot < 0:
		mb.fs.warn("Partial cache: offset slot index %d is less zero", slot)
		return 0, 0, false, errPartialCache
	case slot >= len(mb.cache.idx):
		mb.fs.warn("Partial cache: offset slot index %d is greater than index len %d", slot, len(mb.cache.idx))
		return 0, 0, false, errPartialCache
	}

	bi := mb.cache.idx[slot]
	ri, hashChecked := (bi &^ cbit), (bi&cbit) != 0

	// If this is a deleted slot return here.
	if bi == dbit {
		return 0, 0, false, errDeletedMsg
	}

	// Determine record length
	var rl uint32
	// Need to account for dbit markers in idx.
	// So we will walk until we find valid idx slot to calculate rl.
	for i := 1; slot+i < len(mb.cache.idx); i++ {
		ni := mb.cache.idx[slot+i] &^ cbit
		if ni == dbit {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. No operator action usually needed: the caller falls back to loading the block from disk
  2. If frequent, tune cache limits/expiry so the relevant block stays cached
  3. Check for concurrent cache eviction racing lookups
Defensive patterns

Strategy: type-guard

When it happens

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