{"record":{"id":"38873836223f924a","repo":"Hmbown/CodeWhale","slug":"failed-to-launch-browser-command-err","errorCode":null,"errorMessage":"failed to launch browser command: {err}","messagePattern":"failed to launch browser command: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/tui/ui.rs","lineNumber":940,"sourceCode":"pub(crate) mod frame;\nmod overlays;\nmod provider_routes;\nmod session_state;\n\npub(crate) use frame::*;\npub(crate) use overlays::*;\npub(crate) use provider_routes::*;\npub(crate) use session_state::*;\n\n#[cfg(test)]\nfn spawn_external_url_command(mut command: Command) -> Result<()> {\n    command\n        .stdin(Stdio::null())\n        .stdout(Stdio::null())\n        .stderr(Stdio::null())\n        .spawn()\n        .map(|_| ())\n        .map_err(|err| anyhow::anyhow!(\"failed to launch browser command: {err}\"))\n}\n\nasync fn execute_command_input(\n    terminal: &mut AppTerminal,\n    app: &mut App,\n    engine_handle: &mut EngineHandle,\n    task_manager: &SharedTaskManager,\n    config: &mut Config,\n    input: &str,\n) -> Result<bool> {\n    let _ = app.note_manual_command_for_tip(input);\n    if let Some(parsed_index) = parse_queue_send_command(input) {\n        match parsed_index {\n            Ok(index) => {\n                send_queued_message_at_index_now(app, config, engine_handle, index).await?;\n            }\n            Err(message) => {\n                app.status_message = Some(message);","sourceCodeStart":922,"sourceCodeEnd":958,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/tui/src/tui/ui.rs#L922-L958","documentation":"spawn_external_url_command builds an OS command (e.g. xdg-open/open/browser binary) to open a URL and calls .spawn(). When the OS fails to start the process — binary not found, permission denied, exec format error — the io::Error is wrapped into this anyhow error. The TUI then reports that the URL could not be opened in a browser.","triggerScenarios":"Calling spawn_external_url_command (via the URL opener path, e.g. from a test or the external_url_launcher) when the configured browser/open command does not exist on PATH, is not executable, or the OS refuses to fork/exec.","commonSituations":"Minimal Docker/container images or headless servers with no xdg-open, sensible-browser, or open installed; a BROWSER env var pointing at a nonexistent binary; PATH not set in the launch environment; macOS on Linux or vice versa.","solutions":["Install an opener for your platform (xdg-open on Linux via xdg-utils, `open` exists on macOS) or install a browser.","Check/fix the BROWSER environment variable so it names an existing executable.","Verify the command exists: run `which xdg-open` (or the configured binary) in the same environment; fix PATH if missing.","In code, fall back to printing the URL so the user can open it manually when spawn fails."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"let cmd = opener_command(); // e.g. xdg-open / open\nif which::which(&cmd).is_err() {\n    eprintln!(\"No browser opener found; open this URL manually: {url}\");\n    return Ok(());\n}","typeGuard":"fn opener_available(cmd: &str) -> bool { std::process::Command::new(cmd).arg(\"--version\").output().is_ok() }","tryCatchPattern":"match spawn_external_url_command(&cmd, &url) {\n    Ok(()) => {},\n    Err(err) => {\n        log::warn!(\"{err}\");\n        print!(\"Open manually: {url}\"); // graceful fallback\n    }\n}","preventionTips":["Ensure xdg-utils (Linux) is installed in containers/servers, or set BROWSER to a real executable.","Check `which xdg-open` / `$BROWSER` in the same environment the TUI runs in.","Keep a fallback that echoes the URL so users on headless machines are never stuck."],"tags":["browser","process-spawn","platform","rust"],"backgroundTag":"command-not-found","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}