{"record":{"id":"454e353ee087fbbc","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 ?? 'your content config file'}\" 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":204,"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":186,"sourceCodeEnd":213,"githubUrl":"https://github.com/withastro/astro/blob/157c500c38faa7ecf1251adbaeefcd109470d75c/packages/astro/src/content/config.ts#L186-L213","documentation":"`defineCollection` rejects loader objects that expose `loadEntry`/`loadCollection` but no `load()` — the shape of a live loader. Live loaders only function inside `src/live.config.ts` with `defineLiveCollection`; wiring one into a build-time content collection produces a collection that can never sync, so an AstroUserError is thrown pointing at live.config.ts.","triggerScenarios":"`defineCollection({ loader: someLiveLoader })` in src/content.config.ts where the loader implements `loadEntry`/`loadCollection` but not `load`; loader libraries shipping live loaders being used in the build-time config.","commonSituations":"Trying a database/live loader in a build-time collection; migration experiments moving collections between configs; unclear loader package docs not stating which config file each loader belongs in.","solutions":["Move the collection to `src/live.config.ts` and define it with `defineLiveCollection`","For a build-time collection, use a build-time loader (`glob()`, `file()`) that implements `load()`","Check the loader package's docs/exports to confirm whether it is a live or build-time loader before wiring it in"],"exampleFix":"// before — src/content.config.ts\nexport const collections = { docs: defineCollection({ loader: liveDbLoader() }) };\n\n// after — src/live.config.ts\nexport const collections = { docs: defineLiveCollection({ loader: liveDbLoader() }) };","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isLiveLoader(loader) {\n  return (\n    typeof loader === 'object' &&\n    loader !== null &&\n    typeof loader.load !== 'function' &&\n    (typeof loader.loadEntry === 'function' || typeof loader.loadCollection === 'function')\n  );\n}\n\nif (isLiveLoader(config.loader)) {\n  // belongs in src/live.config.ts with defineLiveCollection, not here\n  throw new TypeError('live loader used in a build-time collection');\n}\ndefineCollection(config);","tryCatchPattern":null,"preventionTips":["Confirm each loader's target config (live vs build-time) before wiring it into a collection","Keep live loaders imported only in live.config.ts and build-time loaders only in content.config.ts","When trying out a DB/live loader, start from a live.config.ts example rather than adapting a glob() collection"],"tags":["content-collections","live-content","loaders","migration"],"backgroundTag":"incompatible-loader-type","analyzedSha":"157c500c38faa7ecf1251adbaeefcd109470d75c","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}