withastro/astro · error
Could not read the chunked data store at ${fileURLToPath(dir
Error message
Could not read the chunked data store at ${fileURLToPath(dirPath)}, rebuilding from scratch. ${err instanceof Error ? err.message : err} What it means
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.
Source
Thrown at packages/astro/src/content/mutable-data-store.ts:631
const manifest: DataStoreManifest = JSON.parse(manifestData);
const collections = new Map<string, Map<string, any>>();
for (const collectionName in manifest) {
const parser = new ChunkedCollectionParser();
for (const fileName of manifest[collectionName]) {
// Parsing each part before reading the next prevents raw collection
// contents from accumulating in memory during cache restoration.
parser.add(await fs.readFile(new URL(`./${fileName}`, dirPath), 'utf-8'));
}
collections.set(collectionName, parser.finish());
}
const store = await MutableDataStore.fromMap(collections);
store.#writer = new ChunkedWriter(dirPath, chunkSize);
return store;
} catch (err) {
// The manifest exists but couldn't be read/parsed, or a referenced
// part is missing: the chunked cache is corrupt. Warn loudly and fall
// through to a fresh store so loaders rebuild it.
logger.warn(
'content',
`Could not read the chunked data store at ${fileURLToPath(dirPath)}, rebuilding from scratch. ${err instanceof Error ? err.message : err}`,
);
}
}
// Fresh build, or recovering from a corrupt cache: start empty.
await fs.mkdir(dirPath, { recursive: true });
const store = new MutableDataStore();
store.#writer = new ChunkedWriter(dirPath, chunkSize);
return store;
}
}
// This is the scoped store for a single collection. It's a subset of the MutableDataStore API, and is the only public type.
export interface DataStore {
get: <TData extends Record<string, unknown> = Record<string, unknown>>(
key: string,
) => DataEntry<TData> | undefined;View on GitHub (pinned to e294953aa8)
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
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/astro/src/content/mutable-data-store.ts:631 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of withastro/astro@e294953aa8 (2026-09-09).
Data as JSON: /api/errors/88fb11f43fd0ad0a.
Report an issue: GitHub.