{"record":{"id":"94cf18be5ecc8fbf","repo":"Hmbown/CodeWhale","slug":"cannot-resolve-current-binary-path-e","errorCode":null,"errorMessage":"Cannot resolve current binary path: {e}","messagePattern":"Cannot resolve current binary path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":10266,"sourceCode":"            let mut pool = McpPool::from_config_path_with_workspace_and_plugins(\n                &config_path,\n                workspace,\n                std::sync::Arc::new(plugins.clone()),\n            )?;\n            let errors = pool.connect_all().await;\n            if errors.is_empty() {\n                println!(\"MCP config is valid. All enabled servers connected.\");\n                return Ok(());\n            }\n            eprintln!(\"MCP validation failed:\");\n            for (name, err) in errors {\n                eprintln!(\"  - {name}: {err:#}\");\n            }\n            bail!(\"one or more MCP servers failed validation\");\n        }\n        McpCommand::AddSelf { name, workspace } => {\n            let exe_path = std::env::current_exe()\n                .map_err(|e| anyhow!(\"Cannot resolve current binary path: {e}\"))?;\n            let exe_str = exe_path.to_string_lossy().to_string();\n\n            let mut args = Vec::with_capacity(if workspace.is_some() { 4 } else { 2 });\n            if let Some(ref ws) = workspace {\n                args.push(\"--workspace\".to_string());\n                args.push(ws.clone());\n            }\n            args.push(\"serve\".to_string());\n            args.push(\"--mcp\".to_string());\n\n            crate::mcp::mutate_config(&config_path, None, |cfg| {\n                if cfg.servers.contains_key(&name) {\n                    bail!(\n                        \"MCP server '{name}' already exists in {}. Use `codewhale mcp remove {name}` first, or choose a different --name.\",\n                        config_path.display()\n                    );\n                }\n                cfg.servers.insert(","sourceCodeStart":10248,"sourceCodeEnd":10284,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L10248-L10284","documentation":"Thrown by the `AddSelf` MCP command when `std::env::current_exe()` fails to resolve the path of the currently running binary. Since AddSelf registers this binary itself as an MCP server command, it cannot build the registration without a resolvable executable path and bails.","triggerScenarios":"`std::env::current_exe()` returns Err — the executable was deleted or replaced after launch (common with self-updating/cargo-run temp binaries), /proc lookup failed, or the platform denied path resolution.","commonSituations":"Running from `cargo run` where the target binary was rebuilt/deleted mid-session; deleted binary on Linux (/proc/self/exe dangling); executing via a hardlink that was removed; unusual sandboxed or FUSE filesystems.","solutions":["Re-run the command from a stable, installed binary (not a rebuilt cargo target path)","If the binary was deleted after launch, reinstall or re-copy it, then retry","As a fallback, register the server manually with an explicit absolute path to the binary","Avoid running AddSelf from ephemeral build artifacts; install the CLI first"],"exampleFix":"// before\nlet exe_path = std::env::current_exe()\n    .map_err(|e| anyhow!(\"Cannot resolve current binary path: {e}\"))?;\n// after\nlet exe_path = std::env::current_exe()\n    .map_err(|e| anyhow!(\"Cannot resolve current binary path: {e}; install the binary to a stable location and retry\"))?;\nlet exe_path = if !exe_path.exists() {\n    anyhow::bail!(\"Resolved binary {} no longer exists on disk\", exe_path.display());\n} else { exe_path };","handlingStrategy":"try-catch","validationCode":"// Rust\nlet exe = std::env::current_exe()?;\nif !exe.exists() {\n    bail!(\"running binary at {} no longer exists on disk; reinstall and retry\", exe.display());\n}","typeGuard":null,"tryCatchPattern":"// Rust\nmatch add_self(&name, workspace) {\n    Err(e) if e.to_string().contains(\"Cannot resolve current binary path\") => {\n        eprintln!(\"Binary path unresolvable (deleted/rebuilt?). Install a stable binary and retry, or register manually with an absolute path.\");\n        std::process::exit(1);\n    }\n    other => other,\n}","preventionTips":["Install the CLI to a stable location instead of registering a cargo target/ temp binary","Avoid rebuilding while a session using that binary is live","Manually register the MCP server with an explicit absolute path as a fallback","On self-updating setups, re-run AddSelf after update"],"tags":["filesystem","process","mcp","cli"],"backgroundTag":"file-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}