{"record":{"id":"46c39a4ca5e1692c","repo":"withastro/astro","slug":"livecontentconfigerror-46c39a","errorCode":"LiveContentConfigError","errorMessage":"Collections with type `live` must be defined in a `src/live.config.ts` file. Check your collection definitions in your live content config file.","messagePattern":"Collections with type `live` must be defined in a `src/live\\.config\\.ts` file\\. Check your collection definitions in your live content config file\\.","errorType":"error_code","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/content/runtime.ts","lineNumber":748,"sourceCode":"\t\t\t});\n\t};\n}\n\ntype PropagatedAssetsModule = {\n\t__astroPropagation: true;\n\tgetMod: () => Promise<any>;\n\tcollectedStyles: string[];\n\tcollectedLinks: string[];\n\tcollectedScripts: string[];\n};\n\nfunction isPropagatedAssetsModule(module: any): module is PropagatedAssetsModule {\n\treturn typeof module === 'object' && module != null && '__astroPropagation' in module;\n}\n\nexport function defineCollection(config: any) {\n\tif (config.type === 'live') {\n\t\tthrow new AstroError({\n\t\t\t...AstroErrorData.LiveContentConfigError,\n\t\t\tmessage: AstroErrorData.LiveContentConfigError.message(\n\t\t\t\t'Collections with type `live` must be defined in a `src/live.config.ts` file.',\n\t\t\t),\n\t\t});\n\t}\n\treturn defineCollectionOrig(config);\n}\n\nexport function defineLiveCollection() {\n\tthrow new AstroError({\n\t\t...AstroErrorData.LiveContentConfigError,\n\t\tmessage: AstroErrorData.LiveContentConfigError.message(\n\t\t\t'Live collections must be defined in a `src/live.config.ts` file.',\n\t\t),\n\t});\n}\n","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/content/runtime.ts#L730-L766","documentation":"Thrown by the runtime-shimmed defineCollection() (re-exported into src/content/config.ts) when called with { type: 'live' }. Live collections are not permitted in the standard content config; they must be declared in a dedicated src/live.config.ts. This shim exists to catch users who copy a live-collection example into the wrong file.","triggerScenarios":"In src/content/config.ts (or any module other than src/live.config.ts), calling defineCollection({ type: 'live', loader: ... }) triggers the guard immediately at config-eval time.","commonSituations":"Following a live-collections tutorial but pasting the definition into content/config.ts; upgrading Astro and trying the new live feature in the wrong file; misreading the docs about where live collections live.","solutions":["Create src/live.config.ts and define live collections there using the live-specific API.","Remove the { type: 'live' } collection from src/content/config.ts.","Consult the live collections guide to confirm the correct file and loader API."],"exampleFix":"// before - src/content/config.ts\nimport { defineCollection } from 'astro:content';\nexport const collections = {\n  news: defineCollection({ type: 'live', loader: newsLoader() })\n};\n// after - src/live.config.ts\nimport { defineLiveCollection } from 'astro:content';\nexport const collections = {\n  news: defineLiveCollection({ loader: newsLoader() })\n};","handlingStrategy":"validation","validationCode":"// Enforce file-location convention in your config lint\nimport { readFileSync } from 'node:fs';\nconst cfg = readFileSync('src/content/config.ts','utf-8');\nif (/type:\\s*['\"]live['\"]/.test(cfg)) throw new Error('live collections belong in src/live.config.ts');","typeGuard":"type LiveDef = { type: 'live'; loader: unknown }; const isLiveDef = (c: any): c is LiveDef => c?.type === 'live';","tryCatchPattern":null,"preventionTips":["Keep live collections exclusively in src/live.config.ts.","Use defineLiveCollection (not defineCollection with type:'live') for live collections.","Document the two-config-file split for new contributors."],"tags":["content-collections","live-collections","config","config-mistake"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}