windmill-labs/windmill · error · Error
Directory not found: ${targetDirectory}
Error message
Directory not found: ${targetDirectory} What it means
Thrown by `wmill lint` (runLint) when the target directory does not exist. The CLI resolves the target from the explicit positional argument (or process.cwd()) and calls `stat()` on it; when stat fails (the catch maps it to null) it reports the path as not found before any linting starts.
Source
Thrown at cli/src/commands/lint/lint.ts:661
return issues;
}
export async function runLint(
opts: LintOptions,
directory?: string,
): Promise<LintReport> {
const initialCwd = process.cwd();
const explicitTargetDirectory = directory
? path.resolve(initialCwd, directory)
: undefined;
const { json: _json, ...syncOpts } = opts;
const mergedOpts = await mergeConfigWithConfigFile(syncOpts);
const targetDirectory = explicitTargetDirectory ?? process.cwd();
const stats = await stat(targetDirectory).catch(() => null);
if (!stats) {
throw new Error(`Directory not found: ${targetDirectory}`);
}
if (!stats.isDirectory()) {
throw new Error(`Path is not a directory: ${targetDirectory}`);
}
// When the user specifies a subdirectory (that doesn't contain wmill.yaml),
// skip include/exclude filters since they're relative to the project root.
const isSubdirectory = explicitTargetDirectory &&
!(await stat(path.join(targetDirectory, "wmill.yaml")).catch(() => null));
const ignore = isSubdirectory
? (_p: string, _isDir: boolean) => false
: await ignoreF(mergedOpts);
const root = await FSFSElement(targetDirectory, [], false);
const validator = new WindmillYamlValidator();
const warnings: LintWarning[] = [];
const issues: FileIssue[] = [];
let scannedFiles = 0;View on GitHub (pinned to e474e8803c)
Solutions
- Verify the path exists with `ls <dir>` and correct any typo in the argument.
- Run `wmill lint` from the repository root so the default (process.cwd()) is the right directory.
- If using a relative path, check it is relative to your current working directory, not to wmill.yaml.
- In CI, confirm the checkout/config step created the directory before the lint step runs.
Example fix
// before wmill lint ./src/sripts // after (typo fixed) wmill lint ./src/scripts
Defensive patterns
Strategy: validation
Validate before calling
const target = explicitTargetDirectory ?? process.cwd();
if (!fs.existsSync(target) || !fs.statSync(target).isDirectory()) {
throw new Error(`lint target must be an existing directory: ${target}`);
} Try / catch
try {
await runLint(opts, dir);
} catch (e: any) {
if (e.message.startsWith("Directory not found")) {
console.error(`Check the path: ${e.message}. cwd=${process.cwd()}`);
}
process.exitCode = 2;
} Prevention
- Run lint from the repo root so the default cwd target is always valid.
- Use absolute paths in CI scripts to avoid relative-path surprises.
- Ensure the checkout/prepare step completes before the lint step.
When it happens
Trigger: Running `wmill lint <dir>` where <dir> is misspelled, was deleted, is a dangling symlink, or running lint from a cwd that has been removed by another process.
Common situations: Typo in the path or wrong relative path depth; running the command after a branch switch/build cleanup removed the directory; a CI checkout step placed the project at a different path; dead symlink to a moved folder.
Related errors
- Path is not a directory: ${targetDirectory}
- Invalid migration name '${name}': use only letters, digits,
- File not found: ${filePath}
- Unknown workspace dependencies file format: ${path}. Valid f
- Cannot push flow ${remotePath}: step(s) reference non-worksp
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/ad22e82d9d97417a.
Report an issue: GitHub.