astral-sh/uv · error
Expected the output filename to be `pylock.toml` or `pylock.
Error message
Expected the output filename to be `pylock.toml` or `pylock.<name>.toml`, where `<name>` is non-empty and contains no dots; found `{file_name}` What it means
Error "Expected the output filename to be `pylock.toml` or `pylock.<name>.toml`, where `<name>` is non-empty and contains no dots; found `{file_name}`" thrown in astral-sh/uv.
Source
Thrown at crates/uv/src/commands/pip/compile.rs:161
let format = format.unwrap_or_else(|| {
let extension = output_file.and_then(Path::extension);
if extension.is_some_and(|ext| ext.eq_ignore_ascii_case("txt")) {
PipCompileFormat::RequirementsTxt
} else if extension.is_some_and(|ext| ext.eq_ignore_ascii_case("toml")) {
PipCompileFormat::PylockToml
} else {
PipCompileFormat::RequirementsTxt
}
});
// If the user is exporting to PEP 751, ensure the filename matches the specification.
if matches!(format, PipCompileFormat::PylockToml) {
if let Some(file_name) = output_file
.and_then(Path::file_name)
.and_then(OsStr::to_str)
{
if !is_pylock_toml(file_name) {
return Err(anyhow!(
"Expected the output filename to be `pylock.toml` or `pylock.<name>.toml`, where `<name>` is non-empty and contains no dots; found `{file_name}`",
));
}
}
}
// Respect `UV_PYTHON`
if python.is_none() && python_version.is_none() {
if let Ok(request) = std::env::var(EnvVars::UV_PYTHON) {
if !request.is_empty() {
python = Some(request);
}
}
}
// If `--python` / `-p` is a simple Python version request, we treat it as `--python-version`
// for backwards compatibility. `-p` was previously aliased to `--python-version` but changed to
// `--python` for consistency with the rest of the CLI in v0.6.0. Since we assume metadata isView on GitHub (pinned to f1a42680ff)
When it happens
Trigger: Thrown at crates/uv/src/commands/pip/compile.rs:161 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/790991a84f3b5bef.
Report an issue: GitHub.