withastro/astro · error · AstroError
LiveContentConfigError
LiveContentConfigError
Error message
Collections with type `live` must be defined in a `src/live.config.ts` file. Check your collection definitions in your live content config file.
What it means
defineCollection() exported from astro:content (the helper for src/content.config.ts) rejects configs with type: 'live'. Live collections use a separate config surface — src/live.config.ts with defineLiveCollection — because they require a loader, schema, and optional proxy setup rather than regular collection options, and Astro fails fast when the two are mixed.
Solutions
- Move the live collection definition into src/live.config.ts.
- Define it there with defineLiveCollection({ loader, schema }) instead of defineCollection.
- Keep regular (non-live) collections in src/content.config.ts and import types from astro:content in that file.
- Run astro sync (or restart the dev server) so the new config file is picked up.
Example fix
// before: src/content.config.ts
import { defineCollection } from 'astro:content';
export const collections = {
docs: defineCollection({ type: 'live', loader, schema }),
};
// after: src/live.config.ts
import { defineLiveCollection } from 'astro:content';
export const collections = {
docs: defineLiveCollection({ loader, schema }),
}; Defensive patterns
Strategy: validation
Validate before calling
// Keep the two config surfaces separate: content.config.ts must not see type: 'live'
import { readFileSync } from 'node:fs';
const src = readFileSync('src/content.config.ts', 'utf8');
if (src.includes("type: 'live'") || src.includes('type: "live"')) {
throw new Error('live collections belong in src/live.config.ts');
} Prevention
- Create src/live.config.ts as soon as you adopt live collections; keep the files purpose-built.
- Import defineLiveCollection only in src/live.config.ts and defineCollection only in src/content.config.ts.
- Run astro sync after adding collections to catch config-shape mistakes immediately.
When it happens
Trigger: Writing defineCollection({ type: 'live', ... }) inside src/content.config.ts; copying a live-collections documentation example into the wrong config file.
Common situations: Adopting live collections in Astro 5.x and pasting the example into content.config.ts out of habit; migrating a project incrementally and mixing both config styles in one file.
Related errors
- LiveContentConfigError
- LegacyContentConfigError
- AdapterSupportOutputMismatch
- font family cannot be retrieved by the provider. Did you…
- `cache.set()` was called but caching is not enabled…
AI-assisted analysis of withastro/astro@e294953aa8 (2026-08-18).
Data as JSON: /api/errors/46c39a4ca5e1692c.
Report an issue: GitHub.
Appendix: source
Thrown at packages/astro/src/content/runtime.ts:803
});
};
}
type PropagatedAssetsModule = {
__astroPropagation: true;
getMod: () => Promise<any>;
collectedStyles: string[];
collectedLinks: string[];
collectedScripts: string[];
};
function isPropagatedAssetsModule(module: any): module is PropagatedAssetsModule {
return typeof module === 'object' && module != null && '__astroPropagation' in module;
}
export function defineCollection(config: any) {
if (config.type === 'live') {
throw new AstroError({
...AstroErrorData.LiveContentConfigError,
message: AstroErrorData.LiveContentConfigError.message(
'Collections with type `live` must be defined in a `src/live.config.ts` file.',
),
});
}
return defineCollectionOrig(config);
}
export function defineLiveCollection() {
throw new AstroError({
...AstroErrorData.LiveContentConfigError,
message: AstroErrorData.LiveContentConfigError.message(
'Live collections must be defined in a `src/live.config.ts` file.',
),
});
}
View on GitHub (pinned to e294953aa8)