{"record":{"id":"f504b5aff7494e8e","repo":"withastro/astro","slug":"content-could-not-read-the-chunked-data-store-at","errorCode":null,"errorMessage":"[content] Could not read the chunked data store at ${fileURLToPath(dirPath)}, rebuilding from scratch.","messagePattern":"\\[content\\] Could not read the chunked data store at (.+?), rebuilding from scratch\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/astro/src/content/mutable-data-store.ts","lineNumber":630,"sourceCode":"\t\t\t\tconst manifest: DataStoreManifest = JSON.parse(manifestData);\n\t\t\t\tconst collections = new Map<string, Map<string, any>>();\n\t\t\t\tfor (const collectionName in manifest) {\n\t\t\t\t\tconst parser = new ChunkedCollectionParser();\n\t\t\t\t\tfor (const fileName of manifest[collectionName]) {\n\t\t\t\t\t\t// Parsing each part before reading the next prevents raw collection\n\t\t\t\t\t\t// contents from accumulating in memory during cache restoration.\n\t\t\t\t\t\tparser.add(await fs.readFile(new URL(`./${fileName}`, dirPath), 'utf-8'));\n\t\t\t\t\t}\n\t\t\t\t\tcollections.set(collectionName, parser.finish());\n\t\t\t\t}\n\t\t\t\tconst store = await MutableDataStore.fromMap(collections);\n\t\t\t\tstore.#writer = new ChunkedWriter(dirPath, chunkSize);\n\t\t\t\treturn store;\n\t\t\t} catch (err) {\n\t\t\t\t// The manifest exists but couldn't be read/parsed, or a referenced\n\t\t\t\t// part is missing: the chunked cache is corrupt. Warn loudly and fall\n\t\t\t\t// through to a fresh store so loaders rebuild it.\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[content] Could not read the chunked data store at ${fileURLToPath(dirPath)}, rebuilding from scratch.`,\n\t\t\t\t\terr,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// Fresh build, or recovering from a corrupt cache: start empty.\n\t\tawait fs.mkdir(dirPath, { recursive: true });\n\t\tconst store = new MutableDataStore();\n\t\tstore.#writer = new ChunkedWriter(dirPath, chunkSize);\n\t\treturn store;\n\t}\n}\n\n// This is the scoped store for a single collection. It's a subset of the MutableDataStore API, and is the only public type.\nexport interface DataStore {\n\tget: <TData extends Record<string, unknown> = Record<string, unknown>>(\n\t\tkey: string,\n\t) => DataEntry<TData> | undefined;","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/withastro/astro/blob/157c500c38faa7ecf1251adbaeefcd109470d75c/packages/astro/src/content/mutable-data-store.ts#L612-L648","documentation":"The content layer persists its data store on disk as chunks described by a manifest.json. Astro found the manifest but failed to read or parse it, or one of the referenced part files is missing — the chunked cache is corrupt. It warns with the underlying error and falls through to a fresh empty store so loaders rebuild it from source files; no source data is lost, the next build just re-syncs everything.","triggerScenarios":"The .astro data-store directory is partially deleted or truncated (manifest present, some parts gone); an interrupted build left a half-written chunk; external tools (git clean, sync clients, antivirus) mutated .astro between runs.","commonSituations":"Manually deleting some (not all) files under .astro to 'refresh the cache'; two concurrent builds sharing one project directory; disk-full during a previous write.","solutions":["Treat it as benign — the store rebuilds automatically on the next build or dev-server start","For a clean slate, delete the entire .astro directory and rebuild","Avoid running multiple concurrent builds against the same project directory"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Health check for the chunked data-store cache before a build\nimport { existsSync, readFileSync } from 'node:fs';\nfunction chunkedStoreIntact(dir: string): boolean {\n  const manifest = `${dir}/manifest.json`; // DATA_STORE_MANIFEST_FILE\n  if (!existsSync(manifest)) return true; // fresh build, nothing to restore\n  try {\n    const parts: string[][] = Object.values(JSON.parse(readFileSync(manifest, 'utf-8')));\n    return parts.flat().every((p) => existsSync(`${dir}/${p}`));\n  } catch {\n    return false; // corrupt manifest\n  }\n}\nif (!chunkedStoreIntact('.astro/data-store')) {\n  console.warn('Chunked data store corrupt — Astro will rebuild it from source files automatically.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When clearing the cache, delete the whole .astro directory, never individual chunks","Never run two concurrent builds against the same project directory","Exclude .astro from sync clients, git clean patterns, and antivirus scans"],"tags":["astro","content-collections","cache","data-store","corruption"],"backgroundTag":"corrupt-build-cache","analyzedSha":"157c500c38faa7ecf1251adbaeefcd109470d75c","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}