{"record":{"id":"55f9d2080b4c0b7c","repo":"nikivdev/code","slug":"binary-not-found-55f9d2","errorCode":null,"errorMessage":"binary not found: {}","messagePattern":"binary not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/registry.rs","lineNumber":136,"sourceCode":"\n    let registry_url = resolve_registry_url(opts.registry.as_deref(), registry_cfg)?;\n    let package = resolve_package_name(opts.package.clone(), cfg, registry_cfg, &project_root)?;\n    let bins = resolve_bins(&package, opts.bin.clone(), registry_cfg);\n    let default_bin = resolve_default_bin(&package, &bins, registry_cfg);\n    let version = resolve_registry_version(cfg, opts.version.clone(), &registry_url, &package)?;\n    let latest = resolve_latest_flag(opts.latest, opts.no_latest, registry_cfg);\n\n    if !opts.no_build {\n        build_binaries(&project_root, &bins)?;\n    }\n\n    let target = detect_target_triple()?;\n    let mut binaries = BTreeMap::new();\n    let mut sha256_map = BTreeMap::new();\n    for bin in &bins {\n        let path = project_root.join(\"target\").join(\"release\").join(bin);\n        if !path.exists() {\n            bail!(\"binary not found: {}\", path.display());\n        }\n        let sha = sha256_file(&path)?;\n        let key = format!(\"packages/{}/{}/{}/{}\", package, version, target, bin);\n        binaries.insert(bin.clone(), key);\n        sha256_map.insert(bin.clone(), sha);\n    }\n\n    let mut targets = BTreeMap::new();\n    targets.insert(\n        target.clone(),\n        RegistryTarget {\n            binaries,\n            sha256: sha256_map,\n        },\n    );\n\n    let manifest = RegistryManifest {\n        name: package.clone(),","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/registry.rs#L118-L154","documentation":"publish collects built release binaries from target/release and hashes them for upload. Before hashing, it checks each expected binary exists; if a binary listed in the package manifest is missing from target/release, publish aborts with 'binary not found: <path>'.","triggerScenarios":"Calling publish when `target/release/<bin>` does not exist — typically because `cargo build --release` was not run, the binary name in the config doesn't match the built artifact, or the build was cleaned.","commonSituations":"Forgetting to build in release mode (only debug artifacts exist); typo in the bin name in config; `cargo clean` run after building; cross-compiling so binaries land in target/<triple>/release instead of target/release.","solutions":["Run `cargo build --release` before publishing so the binaries exist in target/release.","Verify the binary names in your publish config match the actual artifacts in target/release.","If cross-compiling, ensure the release binary is placed at target/release/<bin> or adjust the publish flow."],"exampleFix":"// before\nmytool publish   # fails: target/release/mybin missing\n\n// after\ncargo build --release && mytool publish","handlingStrategy":"validation","validationCode":"let missing: Vec<_> = bins.iter()\n    .map(|b| project_root.join(\"target/release\").join(b))\n    .filter(|p| !p.exists())\n    .collect();\nif !missing.is_empty() {\n    return Err(format!(\"build first: missing {:?}\", missing));\n}\n// all present — safe to call publish","typeGuard":null,"tryCatchPattern":"match publish(opts) {\n    Err(e) if e.to_string().starts_with(\"binary not found:\") => {\n        eprintln!(\"Run `cargo build --release` and verify bin names in config, then retry.\");\n        std::process::exit(1);\n    }\n    other => other,\n}","preventionTips":["Always run `cargo build --release` immediately before publish (chain them in CI).","Keep binary names in publish config in sync with Cargo.toml [[bin]] entries.","Avoid `cargo clean` between build and publish.","In CI, cache/restore the target/release directory or build in the publish job."],"tags":["build","publish","missing-file"],"backgroundTag":"artifact-binary-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}