{"record":{"id":"003e650b455ab507","repo":"linera-io/linera-protocol","slug":"failed-to-resolve-binary-name","errorCode":null,"errorMessage":"Failed to resolve binary {name}","messagePattern":"Failed to resolve binary (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-base/src/command.rs","lineNumber":78,"sourceCode":") -> Result<PathBuf> {\n    let current_binary = current_binary.as_ref();\n    debug!(\n        \"Resolving binary {name} based on the current binary path: {}\",\n        current_binary.display()\n    );\n\n    let current_binary_parent =\n        binary_parent(current_binary).expect(\"Fetching binary directory should not fail\");\n\n    let binary = current_binary_parent.join(name);\n    let version = format!(\"v{}\", env!(\"CARGO_PKG_VERSION\"));\n    if !binary.exists() {\n        error!(\n            \"Cannot find a binary {name} in the directory {}. \\\n             Consider using `cargo install {package}` or `cargo build -p {package}`\",\n            current_binary_parent.display()\n        );\n        bail!(\"Failed to resolve binary {name}\");\n    }\n\n    // Quick version check.\n    debug!(\"Checking the version of {}\", binary.display());\n    let version_message = Command::new(&binary)\n        .arg(\"--version\")\n        .output()\n        .await\n        .with_context(|| {\n            format!(\n                \"Failed to execute and retrieve version from the binary {name} in directory {}\",\n                current_binary_parent.display()\n            )\n        })?\n        .stdout;\n    let version_message = String::from_utf8_lossy(&version_message);\n    let found_version = parse_version_message(&version_message);\n    if version != found_version {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-base/src/command.rs#L60-L96","documentation":"resolve_binary (used across Linera tooling to spawn helper binaries like proxies and workers) looks for the requested binary next to the currently running executable and bails if it is not present. The error log printed just before suggests the fix: build or install the missing package so the binary sits in the same directory as the current executable.","triggerScenarios":"A Linera binary spawning a sibling process (e.g. linera-server/net-up launching linera-proxy or linera-storage-service) when only one package of the workspace was built — the sibling binary was never produced in target/<profile>/.","commonSituations":"cargo build -p linera-server alone instead of building the workspace; cargo install of a single package putting binaries in ~/.cargo/bin while the running binary lives elsewhere; partial Docker images copying only one binary; running binaries from target/debug/deps (test harness) where siblings are missing.","solutions":["Build the needed package so its binary lands beside the current one: cargo build -p <package>","Or build the whole workspace (make build / cargo build) before running local networks","If installed via cargo install, install the companion package at the same version","Copy the missing binary into the running executable's directory"],"exampleFix":"# before\ncargo build -p linera-server && ./target/debug/linera-server ...  # linera-proxy missing\n\n# after\ncargo build -p linera-server -p linera-proxy && ./target/debug/linera-server ...","handlingStrategy":"validation","validationCode":"let binary = linera_base::command::current_binary_parent()?.join(name);\nassert!(binary.exists(), \"{} missing — run `cargo build -p {package}`\", binary.display());\n// only then call resolve_binary(name, package).await","typeGuard":null,"tryCatchPattern":"// resolve_binary returns Result — handle the Err instead of unwrapping:\nmatch linera_base::command::resolve_binary(NAME, PACKAGE).await {\n    Ok(path) => spawn(path),\n    Err(e) => eprintln!(\"missing or unusable {NAME}: {e:#}; build it with cargo build -p {PACKAGE}\"),\n}","preventionTips":["Build the whole workspace (make build) before running multi-process tooling","In Docker, copy all required sibling binaries from the same build stage","Pre-flight scripts should assert each required binary exists in the executable's directory"],"tags":["tooling","process-spawn","binary","build","environment"],"backgroundTag":"binary-not-found","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}