{"record":{"id":"2acaf09778f12828","repo":"withastro/astro","slug":"data-store-cleared-force","errorCode":null,"errorMessage":"data store cleared (force)","messagePattern":"data store cleared \\(force\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/astro/src/core/sync/index.ts","lineNumber":105,"sourceCode":" */\nexport async function clearContentLayerCache({\n\tsettings,\n\tlogger,\n\tfs = fsMod,\n\tisDev,\n}: {\n\tsettings: AstroSettings;\n\tlogger: AstroLogger;\n\tfs?: typeof fsMod;\n\tisDev: boolean;\n}) {\n\tif (getDataStoreChunkSize(settings) !== undefined) {\n\t\tconst dataStore = getDataStoreDir(settings, isDev);\n\t\tif (fs.existsSync(dataStore)) {\n\t\t\tlogger.debug('content', 'clearing data store');\n\t\t\tawait fs.promises.rm(dataStore, { force: true, recursive: true });\n\t\t\tawait fs.promises.mkdir(dataStore, { recursive: true });\n\t\t\tlogger.warn('content', 'data store cleared (force)');\n\t\t}\n\t} else {\n\t\tconst dataStore = getDataStoreFile(settings, isDev);\n\t\tif (fs.existsSync(dataStore)) {\n\t\t\tlogger.debug('content', 'clearing data store');\n\t\t\tawait fs.promises.rm(dataStore, { force: true });\n\t\t\tlogger.warn('content', 'data store cleared (force)');\n\t\t}\n\t}\n}\n\n/**\n * Generates TypeScript types for all Astro modules. This sets up a `src/env.d.ts` file for type inferencing,\n * and defines the `astro:content` module for the Content Collections API.\n *\n * @experimental The JavaScript API is experimental\n */\nexport async function syncInternal({","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/withastro/astro/blob/e294953aa8aadd98d5be92e60a03037b05dbdfd4/packages/astro/src/core/sync/index.ts#L87-L123","documentation":"With experimental.collectionStorage set to 'chunked' or { chunkSize }, the content-layer data store lives in a directory. When a sync force-clears the store it removes and recreates that directory, then logs this warning (domain 'content') so you know all stored collection data was discarded and will be rebuilt by the following sync. It is an expected consequence of a forced clear, not a fault.","triggerScenarios":"experimental.collectionStorage resolves to a chunk size and the data store directory exists when clearDataStore runs — e.g. corrupted store recovery, collectionStorage config changes, or a forced re-sync during dev.","commonSituations":"Adopting the experimental chunked collection storage; toggling between single-file and chunked modes; CI caches where the store directory is wiped between runs.","solutions":["Treat it as informational — the next content sync repopulates the store from your loaders","If the clear was unexpected, find what triggered the forced sync (config change, manual .astro deletion, loader error recovery)","Stop deleting the data store directory in CI caches so syncs can reuse incremental state"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nconst storeReady =\n  existsSync('.astro/data-store.json') || existsSync('.astro/data-store');\nif (!storeReady) {\n  // run `astro sync` before relying on content data\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Expect a full content re-sync after any forced store clear","Cache the chunked store directory in CI when incremental syncs matter","Avoid toggling experimental.collectionStorage modes on a live store"],"tags":["content-collections","data-store","sync","experimental"],"backgroundTag":"data-store-reset","analyzedSha":"e294953aa8aadd98d5be92e60a03037b05dbdfd4","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}