Hmbown/CodeWhale · error

browser opening is unsupported on this platform

Error message

browser opening is unsupported on this platform

What it means

browser_open_command is implemented per-platform via cfg attributes (macOS `open`, Windows `explorer`, BSD variants, etc.). On any target outside the supported cfg list, it falls through to this unconditional error: opening a browser is simply not implemented for that platform.

Solutions

  1. Open the URL manually by copying it from the UI.
  2. Add a cfg arm for your platform in browser_open_command (e.g. `xdg-open` for your Unix flavor) and rebuild.
  3. Run the TUI on a supported platform (macOS, Windows, Linux, *BSD) where an opener is implemented.

Example fix

// before
// no arm for target_os = "solaris"
// after
#[cfg(target_os = "solaris")]
{
    let mut command = Command::new("xdg-open");
    command.arg(url);
    return Ok(command);
}
Defensive patterns

Strategy: fallback

Validate before calling

const SUPPORTED: bool = cfg!(any(
    target_os = "macos", target_os = "linux", target_os = "windows",
    target_os = "netbsd", target_os = "freebsd", target_os = "openbsd",
    target_os = "dragonfly"));
if !SUPPORTED { eprintln!("copy the URL manually: {url}"); }

Try / catch

match open_url(url) {
    Err(e) if e.to_string().contains("unsupported on this platform") => {
        eprintln!("copy this URL into a browser: {url}");
    }
    Err(e) => report(e),
    Ok(()) => {}
}

Prevention

When it happens

Trigger: Calling open_url on an OS not covered by the cfg blocks (e.g. Redox, Solaris/illumos, Haiku, or any unusual target), including cross-compiling the TUI for such a target and invoking the URL-open path.

Common situations: Running the TUI on exotic Unix variants or in environments compiled for an unsupported target; users on less common distros reporting that link-opening fails.

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/540278896e8ae433. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/utils.rs:655

    }

    #[cfg(target_os = "windows")]
    {
        let mut cmd = Command::new("cmd");
        cmd.args(["/C", "start", "", url]);
        Ok(cmd)
    }

    #[cfg(not(any(
        target_os = "macos",
        all(target_os = "linux", not(target_env = "ohos")),
        target_os = "windows",
        target_os = "netbsd",
        target_os = "freebsd",
        target_os = "openbsd",
        target_os = "dragonfly"
    )))]
    Err(anyhow::anyhow!(
        "browser opening is unsupported on this platform"
    ))
}

/// Spawn a tokio task with panic supervision.
///
/// Wraps the future in `AssertUnwindSafe` + `catch_unwind`. On panic:
/// 1. Logs the panic with the task name and caller location via `tracing::error!`.
/// 2. Writes a crash dump to `~/.codewhale/crashes/<timestamp>-<name>.log`.
///
/// The returned `JoinHandle` resolves to `()` — the panic is caught and
/// handled internally so the parent process stays alive.
pub fn spawn_supervised<F>(
    name: &'static str,
    location: &'static std::panic::Location<'static>,
    future: F,
) -> tokio::task::JoinHandle<()>
where

View on GitHub (pinned to 73e0f67d83)