{"record":{"id":"7eadecf7844832cb","repo":"withastro/astro","slug":"live-content-collections-must-be-defined-in-src-l","errorCode":null,"errorMessage":"Live content collections must be defined in \"src/live.config.ts\" file. Check the loaders used in \"${importerFilename}\" to ensure you are not using a live loader to define a build-time content collection.","messagePattern":"Live content collections must be defined in \"src/live\\.config\\.ts\" file\\. Check the loaders used in \"(.+?)\" to ensure you are not using a live loader to define a build-time content collection\\.","errorType":"exception","errorClass":"AstroUserError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/content/config.ts","lineNumber":203,"sourceCode":"\t\t\tmessage: AstroErrorData.LiveContentConfigError.message(\n\t\t\t\t'Collections in a live config file must use `defineLiveCollection`.',\n\t\t\t\timporterFilename,\n\t\t\t),\n\t\t});\n\t}\n\n\tif ('loader' in config) {\n\t\tif (config.type && config.type !== CONTENT_LAYER_TYPE) {\n\t\t\tthrow new AstroUserError(\n\t\t\t\t`A content collection is defined with legacy features (e.g. missing a \\`loader\\` or has a \\`type\\`). Check your collection definitions in ${importerFilename ?? 'your content config file'} to ensure that all collections are defined using the current properties.`,\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\ttypeof config.loader === 'object' &&\n\t\t\ttypeof config.loader.load !== 'function' &&\n\t\t\t('loadEntry' in config.loader || 'loadCollection' in config.loader)\n\t\t) {\n\t\t\tthrow new AstroUserError(\n\t\t\t\t`Live content collections must be defined in \"src/live.config.ts\" file. Check the loaders used in \"${importerFilename ?? 'your content config file'}\" to ensure you are not using a live loader to define a build-time content collection.`,\n\t\t\t);\n\t\t}\n\t\tconfig.type = CONTENT_LAYER_TYPE;\n\t}\n\tif (!config.type) config.type = 'content';\n\treturn config;\n}\n","sourceCodeStart":185,"sourceCodeEnd":212,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/content/config.ts#L185-L212","documentation":"When `defineCollection` is given an object `loader` that lacks a `load` function but exposes `loadEntry`/`loadCollection`, Astro treats it as a live loader placed in a build-time config file — a category error. Live loaders belong in `src/live.config.ts`; build-time loaders (with `load`) belong in `src/content/config.ts`.","triggerScenarios":"Passing a live loader (object with `loadEntry`/`loadCollection` but no `load`) to `defineCollection` inside `src/content/config.ts`.","commonSituations":"Using a live loader integration (e.g. a CMS live loader) inside the build-time config; mixing up which config file is which after renaming.","solutions":["Move the collection to `src/live.config.ts` and define it via `defineLiveCollection`.","Or swap the loader for a build-time loader (`load`-based) such as `glob()` or `file()`.","Confirm whether the loader you imported is a live or build-time loader from its package docs."],"exampleFix":"// before — src/content/config.ts\nimport { myLiveLoader } from 'some-integration/live';\nexport const collections = { cms: defineCollection({ loader: myLiveLoader() }) };\n// after — src/live.config.ts\nimport { defineLiveCollection } from 'astro:content';\nimport { myLiveLoader } from 'some-integration/live';\nexport const collections = { cms: defineLiveCollection({ loader: myLiveLoader() }) };","handlingStrategy":"validation","validationCode":"if (typeof config.loader === 'object' && typeof config.loader.load !== 'function' && ('loadEntry' in config.loader || 'loadCollection' in config.loader)) {\n  throw new Error('This is a live loader — move it to src/live.config.ts');\n}","typeGuard":"function isBuildLoader(l) { return !!l && typeof l.load === 'function'; }","tryCatchPattern":null,"preventionTips":["Check whether a loader exposes `load` (build-time) vs `loadCollection`/`loadEntry` (live) before placing it.","Keep live loaders out of `src/content/config.ts`."],"tags":["content-collections","live-collections","loader","file-location"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}