withastro/astro · warning
No extension found for ${file}
Error message
No extension found for ${file} What it means
configForFile splits a matched path on '.' and takes the last segment to look up the entry type; when that segment is falsy (empty string) there is no extension to map, so the file is skipped with this warning. In practice only degenerate paths reach this branch, since ordinary filenames always yield a non-empty last segment.
Source
Thrown at packages/astro/src/content/loaders/glob.ts:300
// We warn and don't return because we will still set up the watcher in case the directory is created later
logger.warn(`The base directory "${fileURLToPath(baseDir)}" does not exist.`);
}
const files = await tinyglobby(globOptions.pattern, {
cwd: fileURLToPath(baseDir),
expandDirectories: false,
});
if (exists && files.length === 0) {
logger.warn(
`No files found matching "${globOptions.pattern}" in directory "${relativePath}"`,
);
}
function configForFile(file: string) {
const ext = file.split('.').at(-1);
if (!ext) {
logger.warn(`No extension found for ${file}`);
return;
}
return entryTypes.get(`.${ext}`);
}
const limit = pLimit(10);
const skippedFiles: Array<string> = [];
const contentDir = new URL('content/', config.srcDir);
const configFiles = new Set(
['config.js', 'config.ts', 'config.mjs'].map((file) => new URL(file, contentDir).href),
);
function isConfigFile(file: string) {
const fileUrl = new URL('./' + encodeURI(file), baseDir);
return configFiles.has(fileUrl.href);
}View on GitHub (pinned to e294953aa8)
Solutions
- Rename the file to include a real extension
- Exclude the file from the glob pattern if it is not content
Example fix
# before: src/data/blog/draft. # after: rename to src/data/blog/draft.md
Defensive patterns
Strategy: validation
Validate before calling
function hasExtension(file: string): boolean {
const ext = file.split('.').at(-1);
return typeof ext === 'string' && ext.length > 0;
} Prevention
- Enforce real extensions in content file naming conventions
- Exclude extension-less or dot-suffixed oddities from glob patterns
When it happens
Trigger: A matched path whose last '.'-delimited segment is empty, e.g. a file ending in '.' or a malformed entry returned by the glob.
Common situations: Extremely rare; mostly seen with exotic filenames, stray dot-suffixed files, or odd entries emitted by tooling in the content directory.
Related errors
- No entry type found for ${entry}
- 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-18).
Data as JSON: /api/errors/234ef4eaabe8f970.
Report an issue: GitHub.