{"record":{"id":"0d21ab0f65d73d98","repo":"nats-io/nats-server","slug":"cache-lookup-for-sequence-d-in-block-d-detected","errorCode":null,"errorMessage":"Cache lookup for sequence %d in block %d detected no cache: %s","messagePattern":"Cache lookup for sequence (.+?) in block (.+?) detected no cache: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/filestore.go","lineNumber":9122,"sourceCode":"\t\treturn nil, errDeletedMsg\n\t}\n\n\t// Detect no cache loaded.\n\tif mb.cache == nil {\n\t\tmb.cache = mb.ecache.Value()\n\t}\n\tif mb.cache == nil || mb.cache.fseq == 0 || len(mb.cache.idx) == 0 || len(mb.cache.buf) == 0 {\n\t\tvar reason string\n\t\tif mb.cache == nil {\n\t\t\treason = \"no cache\"\n\t\t} else if mb.cache.fseq == 0 {\n\t\t\treason = \"fseq is 0\"\n\t\t} else if len(mb.cache.idx) == 0 {\n\t\t\treason = \"no idx present\"\n\t\t} else {\n\t\t\treason = \"cache buf empty\"\n\t\t}\n\t\tmb.fs.warn(\"Cache lookup for sequence %d in block %d detected no cache: %s\", seq, mb.index, reason)\n\t\tif mb.cache != nil {\n\t\t\tmb.tryForceExpireCacheLocked()\n\t\t}\n\t\treturn nil, errNoCache\n\t}\n\t// Check partial cache status.\n\tif seq < mb.cache.fseq {\n\t\tmb.fs.warn(\"Partial cache: seq %d is less than cache fseq %d\", seq, mb.cache.fseq)\n\t\treturn nil, errPartialCache\n\t}\n\n\tbi, _, hashChecked, err := mb.slotInfo(int(seq - mb.cache.fseq))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Update cache activity.\n\tmb.llts = ats.AccessTime()","sourceCodeStart":9104,"sourceCodeEnd":9140,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/filestore.go#L9104-L9140","documentation":"A cache lookup for a sequence found the block's in-memory cache unusable (nil cache, first-seq 0, empty index, or empty buffer) with the specific reason logged. The store forces cache expiry/rebuild so a later lookup reloads the data from disk instead of serving from stale cache.","triggerScenarios":"Thrown at server/filestore.go:9122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No data is lost; the cache is rebuilt on demand","If frequent, check memory pressure causing aggressive cache eviction","Ensure the msg block files are readable on disk"],"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"}