{"record":{"id":"ad22e82d9d97417a","repo":"windmill-labs/windmill","slug":"directory-not-found-targetdirectory","errorCode":null,"errorMessage":"Directory not found: ${targetDirectory}","messagePattern":"Directory not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/lint/lint.ts","lineNumber":661,"sourceCode":"  return issues;\n}\n\nexport async function runLint(\n  opts: LintOptions,\n  directory?: string,\n): Promise<LintReport> {\n  const initialCwd = process.cwd();\n  const explicitTargetDirectory = directory\n    ? path.resolve(initialCwd, directory)\n    : undefined;\n\n  const { json: _json, ...syncOpts } = opts;\n  const mergedOpts = await mergeConfigWithConfigFile(syncOpts);\n  const targetDirectory = explicitTargetDirectory ?? process.cwd();\n\n  const stats = await stat(targetDirectory).catch(() => null);\n  if (!stats) {\n    throw new Error(`Directory not found: ${targetDirectory}`);\n  }\n  if (!stats.isDirectory()) {\n    throw new Error(`Path is not a directory: ${targetDirectory}`);\n  }\n\n  // When the user specifies a subdirectory (that doesn't contain wmill.yaml),\n  // skip include/exclude filters since they're relative to the project root.\n  const isSubdirectory = explicitTargetDirectory &&\n    !(await stat(path.join(targetDirectory, \"wmill.yaml\")).catch(() => null));\n  const ignore = isSubdirectory\n    ? (_p: string, _isDir: boolean) => false\n    : await ignoreF(mergedOpts);\n  const root = await FSFSElement(targetDirectory, [], false);\n  const validator = new WindmillYamlValidator();\n\n  const warnings: LintWarning[] = [];\n  const issues: FileIssue[] = [];\n  let scannedFiles = 0;","sourceCodeStart":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/lint/lint.ts#L643-L679","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nwmill lint ./src/sripts\n\n// after (typo fixed)\nwmill lint ./src/scripts","handlingStrategy":"validation","validationCode":"const target = explicitTargetDirectory ?? process.cwd();\nif (!fs.existsSync(target) || !fs.statSync(target).isDirectory()) {\n  throw new Error(`lint target must be an existing directory: ${target}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runLint(opts, dir);\n} catch (e: any) {\n  if (e.message.startsWith(\"Directory not found\")) {\n    console.error(`Check the path: ${e.message}. cwd=${process.cwd()}`);\n  }\n  process.exitCode = 2;\n}","preventionTips":["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."],"tags":["cli","filesystem","validation"],"backgroundTag":"directory-not-found","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}