{"record":{"id":"0091d7acaa2d3fad","repo":"astral-sh/uv","slug":"file-not-found","errorCode":null,"errorMessage":"File not found: `{}`","messagePattern":"File not found: `(.+?)`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/uv-requirements/src/specification.rs","lineNumber":276,"sourceCode":"            RequirementsSource::Package(requirement) => Self {\n                requirements: vec![UnresolvedRequirementSpecification::from(\n                    requirement.clone(),\n                )],\n                ..Self::default()\n            },\n            RequirementsSource::Editable(requirement) => {\n                let mut requirement = requirement.clone();\n                requirement.make_editable().with_context(|| {\n                    format!(\"Unsupported editable requirement: `{requirement}`\")\n                })?;\n                Self {\n                    requirements: vec![UnresolvedRequirementSpecification::from(requirement)],\n                    ..Self::default()\n                }\n            }\n            RequirementsSource::RequirementsTxt(path) => {\n                if !(path.starts_with(\"http://\") || path.starts_with(\"https://\") || path.exists()) {\n                    return Err(anyhow::anyhow!(\"File not found: `{}`\", path.user_display()));\n                }\n\n                let requirements_txt =\n                    RequirementsTxt::parse_with_cache(path, &*CWD, client_builder, cache).await?;\n\n                if requirements_txt == RequirementsTxt::default() {\n                    warn_user!(\n                        \"Requirements file `{}` does not contain any dependencies\",\n                        path.user_display()\n                    );\n                }\n\n                Self::from_requirements_txt(requirements_txt)\n            }\n            RequirementsSource::PyprojectToml(path) => {\n                let content = match fs_err::tokio::read_to_string(&path).await {\n                    Ok(content) => content,\n                    Err(err) if err.kind() == std::io::ErrorKind::NotFound => {","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv-requirements/src/specification.rs#L258-L294","documentation":"Thrown in RequirementsSpecification::from_source_with_cache (crates/uv-requirements/src/specification.rs:276) when a RequirementsTxt source path is not an http:// or https:// URL and does not exist on disk. uv checks existence before attempting to parse so the user gets a clear message instead of a raw io::Error from the parser.","triggerScenarios":"`uv pip install -r missing.txt`, `uv pip compile -r reqs/prod.txt` from the wrong working directory, or programmatically building a RequirementsSource::RequirementsTxt for a path that was deleted or never created; note `-r -` (stdin) becomes an Extensionless source and never hits this.","commonSituations":"Running uv from a different cwd than assumed (paths are resolved relative to the invocation directory, not the pyproject); CI checkout missing a generated requirements file; typos or stale paths in scripts; a file present locally but absent in Docker build context.","solutions":["Verify the file exists at the path uv resolved: `ls` the exact relative path from your current directory","Run uv from the directory containing the file, or use an absolute path","If the file is remote, pass a full http(s):// URL (those bypass the existence check)"],"exampleFix":"# before (run from repo root, file lives in deploy/)\nuv pip install -r requirements.txt\n# after\nuv pip install -r deploy/requirements.txt","handlingStrategy":"validation","validationCode":"fn requirements_source_usable(path: &Path) -> bool {\n    let s = path.to_string_lossy();\n    s.starts_with(\"http://\") || s.starts_with(\"https://\") || path.exists()\n}\n\nif !requirements_source_usable(&path) {\n    return Err(anyhow::anyhow!(\"File not found: `{}`\", path.display()));\n}","typeGuard":null,"tryCatchPattern":"match RequirementsSpecification::from_source(source, &client_builder).await {\n    Err(err) if err.to_string().starts_with(\"File not found:\") => {\n        // resolve/locate the file, prompt the user, or skip\n    }\n    spec => spec?,\n}","preventionTips":["Resolve requirement paths to absolute paths before invoking uv","Assert required files exist at the start of CI jobs with a fast-fail check","Remember paths resolve relative to the invocation cwd, not the pyproject location"],"tags":["uv","requirements-file","file-not-found","path","pip-interface"],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}