astral-sh/uv · error · anyhow::Error
The file `{}` appears to be a `{}` file, but requirements mu
Error message
The file `{}` appears to be a `{}` file, but requirements must be specified in `requirements.txt` format What it means
Error "The file `{}` appears to be a `{}` file, but requirements must be specified in `requirements.txt` format" thrown in astral-sh/uv.
Source
Thrown at crates/uv-requirements/src/sources.rs:87
Ok(Self::RequirementsTxt(path))
} else if path.extension().is_none() {
// If we don't have an extension, mark it as extensionless so we can detect
// the format later (either a PEP 723 script or a requirements.txt file).
Ok(Self::Extensionless(path))
} else {
Ok(Self::RequirementsTxt(path))
}
}
/// Parse a [`RequirementsSource`] from a `requirements.txt` file.
pub fn from_requirements_txt(path: PathBuf) -> Result<Self> {
if path == Path::new("-") {
return Ok(Self::Extensionless(path));
}
for file_name in ["pyproject.toml", "setup.py", "setup.cfg"] {
if path.ends_with(file_name) {
return Err(anyhow::anyhow!(
"The file `{}` appears to be a `{}` file, but requirements must be specified in `requirements.txt` format",
path.user_display(),
file_name
));
}
}
if path
.file_name()
.and_then(OsStr::to_str)
.is_some_and(is_pylock_toml)
{
return Err(anyhow::anyhow!(
"The file `{}` appears to be a `pylock.toml` file, but requirements must be specified in `requirements.txt` format",
path.user_display(),
));
} else if path
.extension()
.is_some_and(|ext| ext.eq_ignore_ascii_case("toml"))View on GitHub (pinned to f1a42680ff)
When it happens
Trigger: Thrown at crates/uv-requirements/src/sources.rs:87 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16).
Data as JSON: /api/errors/0525456879c543b3.
Report an issue: GitHub.