{"record":{"id":"ff78a8b3f002834d","repo":"vercel/next.js","slug":"index-block-of-08-sst-is-too-short-bytes","errorCode":null,"errorMessage":"index block {} of {:08}.sst is too short ({} bytes)","messagePattern":"index block (.+?) of (.+?)\\.sst is too short \\((.+?) bytes\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"turbopack/crates/turbo-persistence/src/static_sorted_file.rs","lineNumber":409,"sourceCode":"            uncompressed_length == 0,\n            \"index block {} of {:08}.sst is compressed, but index blocks are always written \\\n             uncompressed\",\n            block_index,\n            meta.sequence_number\n        );\n        // Verified here rather than through `verified_blocks`: this is the one and only read of\n        // this block's bytes, so the bitmap would never save any work for it.\n        let data = &*block;\n        verify_checksum(meta, data, checksum, block_index)?;\n\n        ensure!(\n            data.len() >= INDEX_BLOCK_HEADER_SIZE,\n            \"index block {} of {:08}.sst is too short ({} bytes)\",\n            block_index,\n            meta.sequence_number,\n            data.len()\n        );\n        ensure!(\n            be::read_u8(data) == BLOCK_TYPE_INDEX,\n            \"block {} of {:08}.sst is the last block but not an index block (type {})\",\n            block_index,\n            meta.sequence_number,\n            be::read_u8(data)\n        );\n        let first_block = be::read_u16(&data[1..]);\n        let entry_bytes = &data[INDEX_BLOCK_HEADER_SIZE..];\n        ensure!(\n            entry_bytes.len().is_multiple_of(INDEX_BLOCK_ENTRY_SIZE),\n            \"index block {} of {:08}.sst has {} trailing bytes past its last entry\",\n            block_index,\n            meta.sequence_number,\n            entry_bytes.len() % INDEX_BLOCK_ENTRY_SIZE\n        );\n\n        let entries = match backing {\n            // Store a range, not the slice: `StaticSortedFile` owns the mmap these bytes live in.","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/vercel/next.js/blob/34433fd12ee8074ea3f47af9f36255c7390d0301/turbopack/crates/turbo-persistence/src/static_sorted_file.rs#L391-L427","documentation":"turbo-persistence validates, while parsing an SST file, that the block flagged as the index block is at least INDEX_BLOCK_HEADER_SIZE bytes. This ensure! fails when the index block read from the file (or block cache) is truncated or corrupt, so the persistence layer cannot trust its structure.","triggerScenarios":"Opening/reading a {:08}.sst file whose index block is shorter than the fixed header size — typically after a truncated write, disk-full condition, or manual tampering with the cache directory.","commonSituations":"A Turbopack persistent cache directory corrupted by a crash or power loss mid-write; copying or rsyncing a cache directory while it was being written; a disk with bad sectors.","solutions":["Delete the corrupted cache directory (the persistent cache location for Turbopack) and let it be rebuilt on the next build.","Verify no other process concurrently writes to the cache directory while builds run.","Check available disk space and filesystem health for the volume holding the cache.","If reproducible, capture the file and report it as a turbo-persistence corruption bug."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if (fs.existsSync(cacheDir) && !isCacheDirHealthy(cacheDir)) {\n  fs.rmSync(cacheDir, { recursive: true, force: true });\n}","typeGuard":null,"tryCatchPattern":"try {\n  runBuildWithCache(cacheDir);\n} catch (e) {\n  if (/is too short \\(\\d+ bytes\\)/.test(String(e))) {\n    fs.rmSync(cacheDir, { recursive: true, force: true });\n    runBuildWithCache(cacheDir); // rebuild fresh cache\n  } else throw e;\n}","preventionTips":["Never kill builds or the machine mid-write to the cache directory.","Keep enough free disk space on the cache volume.","Avoid sharing or copying the cache directory between machines or concurrent builds.","Periodically clear the persistent cache."],"tags":["storage","corruption","cache","rust"],"backgroundTag":"internal-invariant-violation","analyzedSha":"34433fd12ee8074ea3f47af9f36255c7390d0301","analyzedAt":"2026-09-20T18:20:20.576Z","contentChangedAt":"2026-09-20T18:20:20.576Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}