{"record":{"id":"a17a5206c5a2114c","repo":"astral-sh/uv","slug":"the-file-appears-to-be-a-toml-file-but-overr","errorCode":null,"errorMessage":"The file `{}` appears to be a TOML file, but overrides must be specified in `requirements.txt` format","messagePattern":"The file `(.+?)` appears to be a TOML file, but overrides must be specified in `requirements\\.txt` format","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/uv-requirements/src/sources.rs","lineNumber":179,"sourceCode":"                    path.user_display(),\n                    file_name\n                ));\n            }\n        }\n        if path\n            .file_name()\n            .and_then(OsStr::to_str)\n            .is_some_and(is_pylock_toml)\n        {\n            return Err(anyhow::anyhow!(\n                \"The file `{}` appears to be a `pylock.toml` file, but overrides must be specified in `requirements.txt` format\",\n                path.user_display(),\n            ));\n        } else if path\n            .extension()\n            .is_some_and(|ext| ext.eq_ignore_ascii_case(\"toml\"))\n        {\n            return Err(anyhow::anyhow!(\n                \"The file `{}` appears to be a TOML file, but overrides must be specified in `requirements.txt` format\",\n                path.user_display(),\n            ));\n        }\n        Ok(Self::RequirementsTxt(path))\n    }\n\n    /// Parse a [`RequirementsSource`] from a user-provided string, assumed to be a positional\n    /// package (e.g., `uv pip install flask`).\n    ///\n    /// If the user provided a value that appears to be a `requirements.txt` file or a local\n    /// directory, prompt them to correct it (if the terminal is interactive).\n    pub fn from_package_argument(name: &str) -> Result<Self> {\n        // If the user provided a `requirements.txt` file without `-r` (as in\n        // `uv pip install requirements.txt`), prompt them to correct it.\n        #[expect(clippy::case_sensitive_file_extension_comparisons)]\n        if (name.ends_with(\".txt\") || name.ends_with(\".in\")) && Path::new(&name).is_file() {\n            let term = Term::stderr();","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv-requirements/src/sources.rs#L161-L197","documentation":"Thrown by RequirementsSource::from_overrides_txt (crates/uv-requirements/src/sources.rs:179) when the --overrides path has a .toml extension (case-insensitive) that is not one of the specially-handled project files. Override files must be requirements.txt-format, so any generic TOML is rejected before parsing.","triggerScenarios":"Running `uv pip install --overrides overrides.toml` or `--overrides pinned.TOML`; any from_overrides_txt call whose path extension equals toml ignoring ASCII case.","commonSituations":"Users version their override pins in TOML from other tooling (Poetry/Hatch config, custom manifests) and pass them to uv unchanged; typos where overrides.txt was saved as .toml.","solutions":["Rename/convert the file to overrides.txt with one `package==version` pin per line","If the TOML holds pins under a table, flatten that table into plain requirement lines","Verify the path — the intended .txt overrides file may have been misnamed"],"exampleFix":"# before\nuv pip install -r requirements.txt --overrides overrides.toml\n# after\n# overrides.txt: `urllib3==2.2.1`\nuv pip install -r requirements.txt --overrides overrides.txt","handlingStrategy":"validation","validationCode":"fn overrides_extension_ok(path: &Path) -> bool {\n    path == Path::new(\"-\")\n        || path\n            .extension()\n            .map(|ext| !ext.eq_ignore_ascii_case(\"toml\"))\n            .unwrap_or(true)\n}\n\nif !overrides_extension_ok(&path) {\n    return Err(anyhow::anyhow!(\"{path:?}: overrides must be requirements.txt format\"));\n}","typeGuard":null,"tryCatchPattern":"match RequirementsSource::from_overrides_txt(path) {\n    Err(err) if err.to_string().contains(\"appears to be a TOML file\") => {\n        // flatten the TOML pins into overrides.txt and retry\n    }\n    source => source?,\n}","preventionTips":["Author overrides as .txt from the start","Automate conversion if your source of truth is TOML (generate .txt in a build step)","Watch for editors auto-appending .toml to saved files"],"tags":["uv","overrides","toml","file-format","pip-interface"],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}