{"record":{"id":"a05df51ee49295b6","repo":"astral-sh/ruff","slug":"provided-project-path-project-is-not-a-directo","errorCode":null,"errorMessage":"Provided project path `{project}` is not a directory","messagePattern":"Provided project path `(.+?)` is not a directory","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ty/src/lib.rs","lineNumber":119,"sourceCode":"\n    let verbosity = args.verbosity.level();\n    let _guard = setup_tracing(verbosity, args.color.unwrap_or_default())?;\n\n    let printer = Printer::new(verbosity, args.no_progress);\n\n    tracing::debug!(\"Version: {}\", version::version());\n\n    // The base path to which all CLI arguments are relative to.\n    let cwd = current_directory()?;\n\n    let project_path = args\n        .project\n        .as_ref()\n        .map(|project| {\n            if project.as_std_path().is_dir() {\n                Ok(SystemPath::absolute(project, &cwd))\n            } else {\n                Err(anyhow!(\n                    \"Provided project path `{project}` is not a directory\"\n                ))\n            }\n        })\n        .transpose()?\n        .unwrap_or_else(|| cwd.clone());\n\n    let check_paths: Vec<_> = args\n        .paths\n        .iter()\n        .map(|path| SystemPath::absolute(path, &cwd))\n        .collect();\n\n    let mode = if args.fix {\n        MainLoopMode::Fix(FixMode::ApplyFixes)\n    } else if args.add_ignore {\n        MainLoopMode::Fix(FixMode::AddIgnore)\n    } else {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/astral-sh/ruff/blob/5bb508f59481c1a02d5c7ff8568b9ffd8a763eef/crates/ty/src/lib.rs#L101-L137","documentation":"ty's `run_check` resolves the project root from the `--project` CLI flag and requires it to be an existing directory. If the provided path exists but is not a directory (or otherwise fails `is_dir()`), it returns this anyhow error instead of proceeding.","triggerScenarios":"Running `ty check --project <path>` where `<path>` is a regular file, symlink to a file, socket, or otherwise not a directory on disk.","commonSituations":"Passing a Python file (e.g. `--project script.py`) instead of the project folder; typos that resolve to a file; scripts that forward a filename where a directory is expected.","solutions":["Pass the project directory, not a file: `ty check --project /path/to/project`","Verify the target with `ls -ld <path>` to confirm it is a directory","If you have a file path, use its parent directory: `--project $(dirname script.py)`"],"exampleFix":"// before\nty check --project ./src/main.py\n// after\nty check --project ./src","handlingStrategy":"validation","validationCode":"import os, sys\nproject = sys.argv[sys.argv.index('--project')+1]\nif not os.path.isdir(project):\n    sys.exit(f\"--project must be a directory, got: {project}\")","typeGuard":"function is_dir(p: str) -> bool {\n  try { return Deno.statSync(p).isDirectory; } catch { return false; }\n}","tryCatchPattern":"match run_check(...) {\n    Err(e) if e.to_string().contains(\"is not a directory\") => {\n        eprintln!(\"--project must point to a directory containing pyproject.toml\");\n        std::process::exit(2);\n    }\n    result => result,\n}","preventionTips":["Always pass a directory containing pyproject.toml to --project, never a .py file","Validate with `test -d \"$PROJECT\"` in shell wrappers before invoking ty","Use `$(dirname \"$file\")` when you only have a file path"],"tags":["cli","path-resolution","type-checker"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"5bb508f59481c1a02d5c7ff8568b9ffd8a763eef","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}