{"record":{"id":"88fb11f43fd0ad0a","repo":"withastro/astro","slug":"could-not-read-the-chunked-data-store-at-fileurl","errorCode":null,"errorMessage":"Could not read the chunked data store at ${fileURLToPath(dirPath)}, rebuilding from scratch. ${err instanceof Error ? err.message : err}","messagePattern":"Could not read the chunked data store at (.+?), rebuilding from scratch\\. (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/astro/src/content/mutable-data-store.ts","lineNumber":631,"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\tlogger.warn(\n\t\t\t\t\t'content',\n\t\t\t\t\t`Could not read the chunked data store at ${fileURLToPath(dirPath)}, rebuilding from scratch. ${err instanceof Error ? err.message : err}`,\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":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/withastro/astro/blob/e294953aa8aadd98d5be92e60a03037b05dbdfd4/packages/astro/src/content/mutable-data-store.ts#L613-L649","documentation":"MutableDataStore.fromDir tried to restore the chunked content-layer data store from the .astro data directory, but reading or parsing one of the chunk files (or the manifest) threw — e.g. a malformed JSON chunk, a truncated file, or an I/O error — with the underlying message appended. The store discards the persisted chunks and rebuilds itself from scratch, so cached content data is regenerated on next use.","triggerScenarios":"Thrown at packages/astro/src/content/mutable-data-store.ts:631 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete the corrupted data store directory (node_modules/.astro or .astro data dir) so it is cleanly rebuilt","Ensure no process writes to the data store while Astro is running (avoid concurrent builds)","If corruption recurs, check for tooling that wipes or truncates files mid-build and report with the appended error message"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e294953aa8aadd98d5be92e60a03037b05dbdfd4","analyzedAt":"2026-09-09T03:35:40.650Z","contentChangedAt":"2026-09-09T03:35:40.650Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}