nikivdev/code · error
package name is required for registry install
Error message
package name is required for registry install
What it means
Error returned when a registry install command is invoked without a package name; the registry subcommand requires at least one package operand.
Source
Thrown at src/registry.rs:218
.put(manifest_url)
.header("Authorization", format!("Bearer {}", token))
.body(serde_json::to_string_pretty(&manifest)?);
if latest {
request = request.query(&[("latest", "1")]);
}
let response = request.send().context("failed to upload manifest")?;
if !response.status().is_success() {
bail!("registry manifest upload failed ({})", response.status());
}
println!("Published {} {} to {}", package, version, registry_url);
Ok(())
}
pub fn install(opts: InstallOpts) -> Result<()> {
let name = opts.name.as_deref().unwrap_or("").trim().to_string();
if name.is_empty() {
bail!("package name is required for registry install");
}
let global_registry = load_global_registry_config();
let registry_url = resolve_registry_url(opts.registry.as_deref(), global_registry.as_ref())?;
let client = Client::builder().timeout(Duration::from_secs(60)).build()?;
let version = opts.version.clone();
let manifest = fetch_manifest(&client, ®istry_url, &name, version.as_deref())?;
let target = detect_target_triple()?;
let target_entry = manifest
.targets
.get(&target)
.with_context(|| format!("No binaries for target {}", target))?;
let bin = resolve_install_bin(&name, &opts.bin, &manifest, target_entry)?;
let path = target_entry
.binaries
.get(&bin)
.with_context(|| format!("No binary '{}' in manifest", bin))?;
let download_url = resolve_download_url(®istry_url, path);
let response = clientView on GitHub (pinned to a747e741ae)
Solutions
- Pass a package name: `mytool install --name <package>`.
- In scripts, verify the name variable is non-empty before invoking install.
- Check quoting so the argument isn't swallowed by the shell.
Example fix
// before mytool install --version 1.2.0 // error: package name is required for registry install // after mytool install --name mypkg --version 1.2.0
Defensive patterns
Strategy: validation
Validate before calling
let name = opts.name.as_deref().unwrap_or("").trim();
if name.is_empty() {
eprintln!("usage: mytool install --name <package>");
std::process::exit(2);
}
// safe to call install Try / catch
match install(opts) {
Err(e) if e.to_string().contains("package name is required") => {
eprintln!("Pass --name <package>; check that the script variable holding the name is set.");
std::process::exit(2);
}
other => other,
} Prevention
- Always pass --name explicitly; never rely on defaulted opts in scripts.
- Quote shell variables: "--name ${PKG:?PKG not set}" to fail fast on empty vars.
- Add a CLI-level check that errors on missing --name before reaching the library.
When it happens
Trigger: Calling install with InstallOpts.name set to None, an empty string, or whitespace-only (e.g. `mytool install --name " "` or programmatically passing empty opts).
Common situations: Forgetting the --name flag on the CLI; a script variable that resolves to empty; shell quoting issues that drop the argument.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No prompt provided. Usage: f agents run {} "your prompt here
- agent run requires a non-empty query
- prompt is empty
- archive message cannot be empty
- archive message must include at least one letter or number
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/c5ed376661c7b989.
Report an issue: GitHub.