astral-sh/uv · error · anyhow::Error
Tool command could not be parsed as UTF-8 string. Use `--fro
Error message
Tool command could not be parsed as UTF-8 string. Use `--from` to specify the package name
What it means
Error "Tool command could not be parsed as UTF-8 string. Use `--from` to specify the package name" thrown in astral-sh/uv.
Source
Thrown at crates/uv/src/commands/tool/run.rs:157
Vec::new()
} else {
read_env_files(env_file.iter())?
};
let Some(command) = command else {
// When a command isn't provided, we'll show a brief help including available tools
show_help(invocation_source, &cache, printer).await?;
// Exit as Clap would after displaying help
return Ok(ExitStatus::Error);
};
let (target, args) = command.split();
let Some(target) = target else {
return Err(anyhow::anyhow!("No tool command provided"));
};
let Some(target) = target.to_str() else {
return Err(anyhow::anyhow!(
"Tool command could not be parsed as UTF-8 string. Use `--from` to specify the package name"
));
};
if let Some(ref from) = from {
if has_python_script_ext(Path::new(from)) {
let package_name = PackageName::from_str(from)?;
return Err(ToolRunScriptError::FromScript {
package_name,
target: target.to_string(),
invocation: invocation_source,
}
.into());
}
} else {
let target_path = Path::new(target);
// If the user tries to invoke `uvx script.py`, hint them towards `uv run`.View on GitHub (pinned to f1a42680ff)
When it happens
Trigger: Thrown at crates/uv/src/commands/tool/run.rs:157 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/e17d4ca4f0c7434e.
Report an issue: GitHub.