eslint/eslint · error · NoFilesFoundError
No files matching '${pattern}' were found${!globEnabled ? "
Error message
No files matching '${pattern}' were found${!globEnabled ? " (glob was disabled)" : ""}. What it means
Thrown as NoFilesFoundError by `throwErrorForUnmatchedPatterns` (eslint-helpers.js:422) when a glob pattern matches no files on disk at all (not even with ignores disabled). `globMatch` returns false (patternHasMatch), confirming the pattern is truly unmatched. messageTemplate is 'file-not-found'.
Source
Thrown at lib/eslint/eslint-helpers.js:422
basePath,
patterns,
rawPatterns,
unmatchedPatterns,
}) {
const pattern = unmatchedPatterns[0];
const rawPattern = rawPatterns[patterns.indexOf(pattern)];
const patternHasMatch = await globMatch({
basePath,
pattern,
});
if (patternHasMatch) {
throw new AllFilesIgnoredError(rawPattern);
}
// if we get here there are truly no matches
throw new NoFilesFoundError(rawPattern, true);
}
/**
* Performs multiple glob searches in parallel.
* @param {Object} options The options for this function.
* @param {Map<string,GlobSearch>} options.searches
* A map of absolute path glob patterns to match.
* @param {ConfigLoader} options.configLoader The config loader to use for
* determining what to ignore.
* @param {boolean} options.errorOnUnmatchedPattern Determines if an
* unmatched glob pattern should throw an error.
* @returns {Promise<Array<string>>} An array of matching file paths
* or an empty array if there are no matches.
*/
async function globMultiSearch({
searches,
configLoader,
errorOnUnmatchedPattern,View on GitHub (pinned to 87f66f4435)
Solutions
- Correct the path or pattern to point at existing files.
- Ensure the ESLint `cwd` option matches the directory the patterns are relative to.
- Set `errorOnUnmatchedPattern: false` if missing patterns should be silently skipped.
- Verify the glob syntax (e.g. use `**/*.js` not `/***/*.js`).
Example fix
// before const eslint = new ESLint(); await eslint.lintFiles(['lib/*.jsx']); // wrong extension // after await eslint.lintFiles(['lib/*.js']);
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('node:fs/promises');
async function fileOrGlobExists(cwd, pattern) {
try { await fs.stat(require('node:path').resolve(cwd, pattern)); return true; } catch {}
const { globby } = await import('fast-glob');
return (await globby(pattern, { cwd, dot: true })).length > 0;
} Try / catch
try {
const results = await eslint.lintFiles([pattern]);
} catch (err) {
if (err.messageTemplate === 'file-not-found') {
console.warn('Pattern not found:', err.messageData.pattern);
return [];
}
throw err;
} Prevention
- Verify paths exist before linting.
- Set errorOnUnmatchedPattern:false for optional inputs.
- Use absolute cwd to avoid relative-path surprises.
When it happens
Trigger: `ESLint#lintFiles(['nonexistent/*.js'])` where the path does not exist. `throwErrorForUnmatchedPatterns` is reached from globMultiSearch when unmatchedPatterns is non-empty and errorOnUnmatchedPattern is true.
Common situations: Typo in path; wrong cwd; deleted/moved files; branch-specific files linted on a different branch; glob syntax error producing a pattern that matches nothing.
Related errors
- No files matching '${rawPatterns}' in '${basePath}' were fou
- All files matched by '${pattern}' are ignored.
- ESLINT_INVALID_OPTIONS
- 'patterns' must be a non-empty string or an array of non-emp
AI-assisted analysis of eslint/eslint@87f66f4435 (2026-08-11).
Data as JSON: /api/errors/e8b1517ad62d7d77.
Report an issue: GitHub.