{"record":{"id":"d5523962aafca8f2","repo":"astrid-runtime/astrid","slug":"name-not-found-ensure-it-is-installed-alongside","errorCode":null,"errorMessage":"{name} not found. Ensure it is installed alongside the astrid CLI or available in PATH.","messagePattern":"(.+?) not found\\. Ensure it is installed alongside the astrid CLI or available in PATH\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/bootstrap.rs","lineNumber":100,"sourceCode":"\n/// Locate a companion binary (e.g. `astrid-daemon`, `astrid-build`).\n///\n/// Search order:\n/// 1. Same directory as the current executable (co-installed)\n/// 2. `PATH` lookup\npub(crate) fn find_companion_binary(name: &str) -> Result<std::path::PathBuf> {\n    if let Ok(exe) = std::env::current_exe()\n        && let Some(dir) = exe.parent()\n    {\n        let candidate = dir.join(name);\n        if candidate.is_file() {\n            return Ok(candidate);\n        }\n    }\n    if let Ok(path) = which::which(name) {\n        return Ok(path);\n    }\n    anyhow::bail!(\n        \"{name} not found. Ensure it is installed alongside the astrid CLI \\\n         or available in PATH.\"\n    )\n}\n\n/// Locate a security-sensitive companion only in the authenticated install set.\n///\n/// Unlike developer-oriented companion discovery, this deliberately refuses a\n/// `PATH` fallback. A storage provider controls what filesystem the operator\n/// sees, so the executable must be co-installed beside this CLI.\npub(crate) fn find_coinstalled_companion_binary(name: &str) -> Result<std::path::PathBuf> {\n    let executable = std::env::current_exe().context(\"resolve the Astrid CLI executable\")?;\n    let directory = executable\n        .parent()\n        .context(\"the Astrid CLI executable has no installation directory\")?;\n    let candidate = directory.join(format!(\"{name}{}\", std::env::consts::EXE_SUFFIX));\n    if candidate.is_file() {\n        return Ok(candidate);","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/bootstrap.rs#L82-L118","documentation":"find_companion_binary locates a companion executable (e.g. the build companion or daemon binary) by checking the CLI's own install directory and then falling back to PATH lookup via which::which. If neither finds an executable, it bails with this message naming the missing binary. The astrid CLI is modular and relies on sibling binaries shipped in the same install set.","triggerScenarios":"Calling run_build_companion, spawn_daemon_inner, or spawn_persistent_daemon when the companion binary is neither next to the astrid CLI executable nor discoverable via PATH.","commonSituations":"Installing only the astrid CLI crate/binary without its companions (partial install, cargo install of a single bin); running astrid from a build directory where companions were not copied; a stripped container image that dropped the companion binaries; PATH not containing the install prefix.","solutions":["Install the full astrid CLI distribution so companion binaries sit beside the astrid executable.","Add the install directory to PATH (or fix PATH in the current shell/container).","Verify the expected binary name plus platform EXE_SUFFIX exists next to the astrid executable.","If running from a source checkout, build the companion binaries (cargo build) so target/ contains them, and run via the workspace so siblings resolve."],"exampleFix":"// before: PATH missing install prefix, companions absent\n$ astrid daemon start\nError: astrid-daemon not found. Ensure it is installed alongside...\n\n// after\n$ export PATH=\"$HOME/.astrid/bin:$PATH\"\n$ ls ~/.astrid/bin/astrid-daemon  # present after full install\n$ astrid daemon start","handlingStrategy":"fallback","validationCode":"let cli_dir = std::env::current_exe()?.parent().unwrap().to_path_buf();\nlet name = \"astrid-daemon\";\nlet sibling = cli_dir.join(format!(\"{name}{}\", std::env::consts::EXE_SUFFIX));\nif !sibling.is_file() && which::which(name).is_err() {\n    eprintln!(\"{name} missing; install the full astrid distribution\");\n}","typeGuard":"fn companion_available(name: &str) -> bool {\n    std::env::current_exe().ok()\n        .and_then(|p| p.parent().map(|d| d.join(format!(\"{name}{}\", std::env::consts::EXE_SUFFIX)).is_file()))\n        .unwrap_or(false)\n        || which::which(name).is_ok()\n}","tryCatchPattern":"match spawn_daemon_inner(&config).await {\n    Ok(h) => { /* ... */ }\n    Err(e) if e.to_string().contains(\"not found. Ensure it is installed\") => {\n        eprintln!(\"companion binary missing; reinstall the full astrid distribution\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Install the complete astrid distribution, not a single binary.","Keep the install prefix on PATH.","In containers, copy all astrid-* binaries into the same directory.","Smoke-test companion lookup after install/upgrade."],"tags":["cli","missing-binary","path","companion"],"backgroundTag":"command-not-found","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}