{"record":{"id":"c83c60026b466a72","repo":"withastro/astro","slug":"livecontentconfigerror","errorCode":"LiveContentConfigError","errorMessage":"Live collections must be defined in a `src/live.config.ts` file. Check your collection definitions in ${importerFilename}.","messagePattern":"Live collections must be defined in a `src/live\\.config\\.ts` file\\. Check your collection definitions in (.+?)\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/content/config.ts","lineNumber":122,"sourceCode":"\tS extends BaseSchema | undefined = undefined,\n> = {\n\ttype?: 'live';\n\tschema?: S;\n\tloader: L;\n};\n\nexport type CollectionConfig<\n\tS extends BaseSchema,\n\tTLoader extends LoaderConstraint<{ id: string }> = LoaderConstraint<{ id: string }>,\n> = ContentCollectionConfig<S> | DataCollectionConfig<S> | ContentLayerConfig<S, TLoader>;\n\nexport function defineLiveCollection<\n\tL extends LiveLoader,\n\tS extends BaseSchema | undefined = undefined,\n>(config: LiveCollectionConfig<L, S>): LiveCollectionConfig<L, S> {\n\tconst importerFilename = getImporterFilename();\n\tif (importerFilename && !importerFilename.includes('live.config')) {\n\t\tthrow new AstroError({\n\t\t\t...AstroErrorData.LiveContentConfigError,\n\t\t\tmessage: AstroErrorData.LiveContentConfigError.message(\n\t\t\t\t'Live collections must be defined in a `src/live.config.ts` file.',\n\t\t\t\timporterFilename ?? 'your content config file',\n\t\t\t),\n\t\t});\n\t}\n\t// Default to live content type if not specified\n\tconfig.type ??= LIVE_CONTENT_TYPE;\n\n\tif (config.type !== LIVE_CONTENT_TYPE) {\n\t\tthrow new AstroError({\n\t\t\t...AstroErrorData.LiveContentConfigError,\n\t\t\tmessage: AstroErrorData.LiveContentConfigError.message(\n\t\t\t\t'Collections in a live config file must have a type of `live`.',\n\t\t\t\timporterFilename,\n\t\t\t),\n\t\t});","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/content/config.ts#L104-L140","documentation":"`defineLiveCollection` is only valid when called from `src/live.config.ts`. The function inspects the importer filename via `getImporterFilename()`; if the filename does not contain `live.config`, it throws `LiveContentConfigError`. Live collections are a separate config stream from build-time content collections and must live in their own file.","triggerScenarios":"Calling `defineLiveCollection(...)` inside `src/content/config.ts` (or any file whose path does not include `live.config`).","commonSituations":"Migrating to live collections but keeping the definition in the existing `content/config.ts`; copy-pasting a live collection example into the wrong config file; renaming `live.config.ts` to something else.","solutions":["Create `src/live.config.ts` and move the `defineLiveCollection(...)` call there.","Leave build-time `defineCollection` calls in `src/content/config.ts`.","Make sure the filename literally contains the substring `live.config` (e.g. `src/live.config.ts`)."],"exampleFix":"// before — src/content/config.ts\nimport { defineLiveCollection } from 'astro:content';\nexport const collections = { live: defineLiveCollection({ loader }) };\n// after — src/live.config.ts\nimport { defineLiveCollection } from 'astro:content';\nexport const collections = { live: defineLiveCollection({ loader }) };","handlingStrategy":"validation","validationCode":"const file = getImporterFilename();\nif (file && !file.includes('live.config')) {\n  throw new Error('Move defineLiveCollection to src/live.config.ts');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep live collections only in `src/live.config.ts`.","Keep build-time collections only in `src/content/config.ts`.","Name the file so its path contains `live.config`."],"tags":["content-collections","live-collections","config","file-location"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}