withastro/astro · warning
No files found matching "${globOptions.pattern}" in director
Error message
No files found matching "${globOptions.pattern}" in directory "${relativePath}" What it means
The base directory exists but tinyglobby matched zero files for the pattern, so the loader warns and returns early. The most common cause is pattern shape: patterns run with expandDirectories: false, so '*.md' will not descend into subdirectories the way '**/*.md' does.
Source
Thrown at packages/astro/src/content/loaders/glob.ts:292
}
const filePath = fileURLToPath(baseDir);
const relativePath = relative(fileURLToPath(config.root), filePath);
const exists = existsSync(baseDir);
if (!exists) {
// 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);
View on GitHub (pinned to e294953aa8)
Solutions
- Use recursive patterns like '**/*.md' or an array of patterns
- Verify files with the exact case and extension exist under the base directory
- Create at least one matching file or fix the base directory if it was also wrong (a separate warning covers that)
Example fix
// before
loader: glob({ pattern: '*.md', base: './src/data/blog' })
// after
loader: glob({ pattern: '**/*.md', base: './src/data/blog' }) Defensive patterns
Strategy: validation
Validate before calling
// Dry-run the exact pattern to catch zero-match configs before build
import { glob } from 'tinyglobby';
const matches = await glob(pattern, { cwd: baseDir, expandDirectories: false });
if (matches.length === 0) {
throw new Error(`Pattern ${JSON.stringify(pattern)} matched nothing under ${baseDir} — did you mean '**/*.md'?`);
} Prevention
- Always include '**/' when entries live in subdirectories; expandDirectories is disabled
- Match extension case exactly (.md vs .MD differ on Linux)
- Keep a pattern smoke-test script for content configs
When it happens
Trigger: A pattern missing the '**/' recursive segment; case mismatches on case-sensitive filesystems; a pattern for extensions that do not exist yet in that tree; an empty directory.
Common situations: Writing pattern: '*.md' expecting recursion into subfolders; renaming extensions (.markdown vs .md); expecting dotfiles to match a normal pattern.
Related errors
- No contents found for ${entry}
- **${collection}** contains multiple entries with the same sl
- The base directory "${fileURLToPath(baseDir)}" does not exis
- No extension found for ${file}
- The glob() loader cannot be used for files in ${colors.bold(
AI-assisted analysis of withastro/astro@e294953aa8 (2026-09-09).
Data as JSON: /api/errors/6f25b01fcfae47d0.
Report an issue: GitHub.