{"record":{"id":"c5ed376661c7b989","repo":"nikivdev/code","slug":"package-name-is-required-for-registry-install","errorCode":null,"errorMessage":"package name is required for registry install","messagePattern":"package name is required for registry install","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/registry.rs","lineNumber":218,"sourceCode":"        .put(manifest_url)\n        .header(\"Authorization\", format!(\"Bearer {}\", token))\n        .body(serde_json::to_string_pretty(&manifest)?);\n    if latest {\n        request = request.query(&[(\"latest\", \"1\")]);\n    }\n    let response = request.send().context(\"failed to upload manifest\")?;\n    if !response.status().is_success() {\n        bail!(\"registry manifest upload failed ({})\", response.status());\n    }\n\n    println!(\"Published {} {} to {}\", package, version, registry_url);\n    Ok(())\n}\n\npub fn install(opts: InstallOpts) -> Result<()> {\n    let name = opts.name.as_deref().unwrap_or(\"\").trim().to_string();\n    if name.is_empty() {\n        bail!(\"package name is required for registry install\");\n    }\n    let global_registry = load_global_registry_config();\n    let registry_url = resolve_registry_url(opts.registry.as_deref(), global_registry.as_ref())?;\n    let client = Client::builder().timeout(Duration::from_secs(60)).build()?;\n    let version = opts.version.clone();\n    let manifest = fetch_manifest(&client, &registry_url, &name, version.as_deref())?;\n    let target = detect_target_triple()?;\n    let target_entry = manifest\n        .targets\n        .get(&target)\n        .with_context(|| format!(\"No binaries for target {}\", target))?;\n    let bin = resolve_install_bin(&name, &opts.bin, &manifest, target_entry)?;\n    let path = target_entry\n        .binaries\n        .get(&bin)\n        .with_context(|| format!(\"No binary '{}' in manifest\", bin))?;\n    let download_url = resolve_download_url(&registry_url, path);\n    let response = client","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/registry.rs#L200-L236","documentation":"Error returned when a registry install command is invoked without a package name; the registry subcommand requires at least one package operand.","triggerScenarios":"Calling install with InstallOpts.name set to None, an empty string, or whitespace-only (e.g. `mytool install --name \" \"` or programmatically passing empty opts).","commonSituations":"Forgetting the --name flag on the CLI; a script variable that resolves to empty; shell quoting issues that drop the argument.","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."],"exampleFix":"// before\nmytool install --version 1.2.0\n// error: package name is required for registry install\n\n// after\nmytool install --name mypkg --version 1.2.0","handlingStrategy":"validation","validationCode":"let name = opts.name.as_deref().unwrap_or(\"\").trim();\nif name.is_empty() {\n    eprintln!(\"usage: mytool install --name <package>\");\n    std::process::exit(2);\n}\n// safe to call install","typeGuard":null,"tryCatchPattern":"match install(opts) {\n    Err(e) if e.to_string().contains(\"package name is required\") => {\n        eprintln!(\"Pass --name <package>; check that the script variable holding the name is set.\");\n        std::process::exit(2);\n    }\n    other => other,\n}","preventionTips":["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."],"tags":["cli","validation","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}