{"record":{"id":"8df2a67262b921f7","repo":"Hmbown/CodeWhale","slug":"warning-could-not-open-the-default-browser-erro","errorCode":null,"errorMessage":"warning: could not open the default browser ({error}); open the bootstrap URL above manually","messagePattern":"warning: could not open the default browser \\((.+?)\\); open the bootstrap URL above manually","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/runtime_api.rs","lineNumber":1141,"sourceCode":"}\n\nfn is_loopback_bind_host(host: &str) -> bool {\n    host.parse::<IpAddr>()\n        .is_ok_and(|address| address.is_loopback())\n}\n\nfn runtime_bind_address(host: &str, port: u16) -> Result<SocketAddr> {\n    let address = match host.parse::<IpAddr>() {\n        Ok(IpAddr::V6(_)) => format!(\"[{host}]:{port}\"),\n        _ => format!(\"{host}:{port}\"),\n    };\n    address\n        .parse()\n        .with_context(|| format!(\"Invalid bind address '{host}:{port}'\"))\n}\n\nfn web_launcher_warning(result: Result<()>) -> Option<String> {\n    result.err().map(|error| {\n        format!(\n            \"warning: could not open the default browser ({error}); open the bootstrap URL above manually\"\n        )\n    })\n}\n\nfn fallback_sessions_dir() -> PathBuf {\n    if let Some(home) = codewhale_paths::codewhale_home_override().ok().flatten() {\n        return home.join(\"sessions\");\n    }\n    codewhale_paths::legacy_deepseek_home()\n        .unwrap_or_else(|| PathBuf::from(codewhale_paths::LEGACY_APP_DIR))\n        .join(\"sessions\")\n}\n\npub fn build_router(state: RuntimeApiState) -> Router {\n    diagnostics::mark_server_started();\n    let api_routes = Router::new()","sourceCodeStart":1123,"sourceCodeEnd":1159,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_api.rs#L1123-L1159","documentation":"When the runtime API server starts, it attempts to open the bootstrap URL in the user's default browser. If that launch fails, the resulting error is formatted into this warning string, shown/logged so the user knows to open the URL manually. It is non-fatal: the server is running regardless.","triggerScenarios":"web_launcher_warning(result) is called with a Result that is Err — the OS-level browser-open command failed on the machine hosting the TUI (e.g. headless server, missing xdg-open).","commonSituations":"Running Codewhale over SSH or in a container without a desktop environment; missing xdg-open/open utilities; WSL without a configured browser; DISPLAY/WAYLAND_SESSION unset.","solutions":["Copy the bootstrap URL printed above the warning and open it manually in any browser.","Install or fix the browser-opener for your platform (xdg-open on Linux, open on macOS).","If headless, use port forwarding (ssh -L) and open the URL from your local machine.","Set BROWSER env var to a usable browser command on the host."],"exampleFix":"// before: headless host has no browser opener\nssh -L 8080:localhost:8080 user@server\n// then open http://localhost:8080 locally\n// after: hint the launcher at a specific browser\nexport BROWSER=/usr/bin/firefox","handlingStrategy":"fallback","validationCode":"// detect a headless environment before attempting a browser launch\nlet headless = std::env::var(\"DISPLAY\").is_err()\n    && std::env::var(\"WAYLAND_SESSION\").is_err()\n    && std::env::var(\"SSH_CONNECTION\").is_ok();","typeGuard":null,"tryCatchPattern":"match open_browser(url) {\n    Ok(()) => {},\n    Err(e) => println!(\"warning: could not open the default browser ({e}); open {url} manually\"),\n}","preventionTips":["On servers, expect no browser: always print the bootstrap URL.","Install xdg-open or set BROWSER on headless Linux hosts.","Use SSH port forwarding for remote sessions."],"tags":["browser","headless","runtime-api","bootstrap-url"],"backgroundTag":"unsupported-platform","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"}