Hmbown/CodeWhale · warning

warning: could not open the default browser

Error message

warning: could not open the default browser ({error}); open the bootstrap URL above manually

What it means

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.

Solutions

  1. Copy the bootstrap URL printed above the warning and open it manually in any browser.
  2. Install or fix the browser-opener for your platform (xdg-open on Linux, open on macOS).
  3. If headless, use port forwarding (ssh -L) and open the URL from your local machine.
  4. Set BROWSER env var to a usable browser command on the host.

Example fix

// before: headless host has no browser opener
ssh -L 8080:localhost:8080 user@server
// then open http://localhost:8080 locally
// after: hint the launcher at a specific browser
export BROWSER=/usr/bin/firefox
Defensive patterns

Strategy: fallback

Validate before calling

// detect a headless environment before attempting a browser launch
let headless = std::env::var("DISPLAY").is_err()
    && std::env::var("WAYLAND_SESSION").is_err()
    && std::env::var("SSH_CONNECTION").is_ok();

Try / catch

match open_browser(url) {
    Ok(()) => {},
    Err(e) => println!("warning: could not open the default browser ({e}); open {url} manually"),
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/8df2a67262b921f7. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/runtime_api.rs:1141

}

fn is_loopback_bind_host(host: &str) -> bool {
    host.parse::<IpAddr>()
        .is_ok_and(|address| address.is_loopback())
}

fn runtime_bind_address(host: &str, port: u16) -> Result<SocketAddr> {
    let address = match host.parse::<IpAddr>() {
        Ok(IpAddr::V6(_)) => format!("[{host}]:{port}"),
        _ => format!("{host}:{port}"),
    };
    address
        .parse()
        .with_context(|| format!("Invalid bind address '{host}:{port}'"))
}

fn web_launcher_warning(result: Result<()>) -> Option<String> {
    result.err().map(|error| {
        format!(
            "warning: could not open the default browser ({error}); open the bootstrap URL above manually"
        )
    })
}

fn fallback_sessions_dir() -> PathBuf {
    if let Some(home) = codewhale_paths::codewhale_home_override().ok().flatten() {
        return home.join("sessions");
    }
    codewhale_paths::legacy_deepseek_home()
        .unwrap_or_else(|| PathBuf::from(codewhale_paths::LEGACY_APP_DIR))
        .join("sessions")
}

pub fn build_router(state: RuntimeApiState) -> Router {
    diagnostics::mark_server_started();
    let api_routes = Router::new()

View on GitHub (pinned to 73e0f67d83)