{"record":{"id":"ca70fd98cd51983d","repo":"astral-sh/uv","slug":"the-file-appears-to-be-a-pylock-toml-file-ca70fd","errorCode":null,"errorMessage":"The file `{}` appears to be a `pylock.toml` file, but overrides must be specified in `requirements.txt` format","messagePattern":"The file `(.+?)` appears to be a `pylock\\.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":171,"sourceCode":"        if path == Path::new(\"-\") {\n            return Ok(Self::Extensionless(path));\n        }\n\n        for file_name in [\"pyproject.toml\", \"setup.py\", \"setup.cfg\"] {\n            if path.ends_with(file_name) {\n                return Err(anyhow::anyhow!(\n                    \"The file `{}` appears to be a `{}` file, but overrides must be specified in `requirements.txt` format\",\n                    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    ///","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv-requirements/src/sources.rs#L153-L189","documentation":"Thrown by RequirementsSource::from_overrides_txt (crates/uv-requirements/src/sources.rs:171) when the --overrides path's file name matches a pylock.toml lock file (is_pylock_toml). Overrides must be requirements.txt-format pins; a PEP 751 lock file is a complete resolution input, not an override list, so uv rejects it early.","triggerScenarios":"Running `uv pip install --overrides pylock.toml ...` or passing a pylock.<name>.toml variant; programmatically calling from_overrides_txt with such a file name.","commonSituations":"Users assume the lock file can be layered as an override on top of a looser requirements.txt; CI pipelines try to force versions by overriding from the lock.","solutions":["Write the intended version pins into an overrides.txt (`package==x.y.z` lines) and pass that instead","If you want the exact locked set, install from the lock directly: `uv pip install -r pylock.toml`","Export pins first: `uv export --format requirements-txt -o overrides.txt`"],"exampleFix":"# before\nuv pip install -r requirements.txt --overrides pylock.toml\n# after\nuv pip install -r pylock.toml","handlingStrategy":"validation","validationCode":"fn is_pylock_toml_name(path: &Path) -> bool {\n    path.file_name()\n        .and_then(std::ffi::OsStr::to_str)\n        .is_some_and(|name| name == \"pylock.toml\" || (name.starts_with(\"pylock.\") && name.ends_with(\".toml\")))\n}\n\nif is_pylock_toml_name(&path) {\n    // export pins to overrides.txt instead of passing the lock\n}","typeGuard":null,"tryCatchPattern":"match RequirementsSource::from_overrides_txt(path) {\n    Err(err) if err.to_string().contains(\"pylock.toml\") => {\n        // convert lock pins into an overrides.txt and retry\n    }\n    source => source?,\n}","preventionTips":["Treat --overrides as pins-only input; locks never go there","Name override files explicitly (overrides.txt) and generate them with `uv export`","Add a pre-flight check in wrappers that scans override paths for pylock names"],"tags":["uv","overrides","pylock-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"}