withastro/astro · warning
No entry type found for ${entry}
Error message
No entry type found for ${entry} What it means
A file matched the glob() loader's pattern, but its extension is not registered as a content or data entry type (built-ins like .md, .json, .yaml, plus types registered by integrations such as @astrojs/mdx for .mdx). syncData() bails out with this warning and the file is not ingested into the collection.
Source
Thrown at packages/astro/src/content/loaders/glob.ts:132
parseData,
store,
generateDigest,
entryTypes,
}) => {
const renderFunctionByContentType = new WeakMap<
ContentEntryType,
ContentEntryRenderFunction
>();
const untouchedEntries = new Set(store.keys());
async function syncData(
entry: string,
base: URL,
entryType?: ContentEntryType,
oldId?: string,
) {
if (!entryType) {
logger.warn(`No entry type found for ${entry}`);
return;
}
const fileUrl = new URL('./' + encodeURI(entry), base);
const contents = await fs.readFile(fileUrl, 'utf-8').catch((err) => {
logger.error(`Error reading ${entry}: ${err.message}`);
return;
});
if (!contents && contents !== '') {
logger.warn(`No contents found for ${entry}`);
return;
}
const { body, data } = await entryType.getEntryInfo({
contents,
fileUrl,
});
View on GitHub (pinned to e294953aa8)
Solutions
- Narrow the glob pattern to supported extensions, e.g. '**/*.md' or ['**/*.md', '**/*.mdx']
- Install and enable the integration that registers the entry type (e.g. @astrojs/mdx for .mdx)
- If you need a custom format, register a ContentEntryType/DataEntryType from an integration
Example fix
// before: src/content.config.ts
const blog = defineCollection({ loader: glob({ pattern: '**/*', base: './src/data/blog' }) });
// after
const blog = defineCollection({ loader: glob({ pattern: ['**/*.md', '**/*.mdx'], base: './src/data/blog' }) }); Defensive patterns
Strategy: type-guard
Validate before calling
// Derive glob patterns from the extensions you actually support instead of '**/*'
const SUPPORTED_EXTENSIONS = ['.md', '.mdx', '.json', '.yaml', '.yml'] as const;
const pattern = SUPPORTED_EXTENSIONS.map((ext) => `**/*${ext}`); Type guard
type ContentFile = `${string}.${'md' | 'mdx' | 'json' | 'yaml' | 'yml'}`;
const REGISTERED_EXTENSIONS = new Set(['.md', '.mdx', '.json', '.yaml', '.yml']);
function hasRegisteredEntryType(file: string): file is ContentFile {
const dot = file.lastIndexOf('.');
return dot !== -1 && REGISTERED_EXTENSIONS.has(file.slice(dot));
} Prevention
- Never use a catch-all pattern like '**/*' for content; enumerate supported extensions
- Install entry-type integrations (e.g. @astrojs/mdx) before referencing their extensions
- When adding a new format, wire its integration first and add the extension to the pattern
When it happens
Trigger: A broad pattern like '**/*' matching .txt/.csv/.asset files; referencing .mdx files without the MDX integration installed or enabled; a custom entry type from an integration that is not loaded in this project.
Common situations: Widening patterns from '**/*.md' to '**/*' and catching stray files; adding notes/draft files with unusual extensions into a content directory; forgetting to run astro add mdx before using .mdx entries.
Related errors
- No extension found for ${file}
- No contents found for ${entry}
- **${collection}** contains multiple entries with the same sl
- The base directory "${fileURLToPath(baseDir)}" does not exis
- The glob() loader cannot be used for files in ${colors.bold(
AI-assisted analysis of withastro/astro@e294953aa8 (2026-08-21).
Data as JSON: /api/errors/5383fd011285fa1f.
Report an issue: GitHub.