zeroclaw-labs/zeroclaw · error

browser_open is not supported on this OS

Error message

browser_open is not supported on this OS

What it means

open_in_system_browser has cfg branches for macOS, Linux, and Windows only; on any other target OS the final #[cfg(not(any(...)))] branch discards the URL and bails with this message (browser_open.rs:267-271). The tool compiles anywhere, but execution is a hard refusal on unsupported platforms. There is no fallback path at all on such targets.

Source

Thrown at crates/zeroclaw-tools/src/browser_open.rs:270

        let mut brave_error = String::new();
        for cmd in ["brave", "brave.exe"] {
            let mut command = tokio::process::Command::new(cmd);
            command.arg(url);
            match run_browser_launcher(command, cmd).await {
                Ok(()) => return Ok(()),
                Err(error) => brave_error = error,
            }
        }

        anyhow::bail!(
            "Failed to open URL with default browser launcher: {primary_error}. Brave compatibility fallback also failed: {brave_error}"
        );
    }

    #[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
    {
        let _ = url;
        anyhow::bail!("browser_open is not supported on this OS");
    }
}

fn extract_host(url: &str) -> anyhow::Result<String> {
    let rest = url
        .strip_prefix("https://")
        .or_else(|| url.strip_prefix("http://"))
        .ok_or_else(|| {
            ::zeroclaw_log::record!(
                WARN,
                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
                    .with_outcome(::zeroclaw_log::EventOutcome::Failure)
                    .with_attrs(::serde_json::json!({"url": url})),
                "browser_open: unsupported URL scheme rejected"
            );
            anyhow::Error::msg("Only http:// or https:// URLs are allowed")
        })?;

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Do not register BrowserOpenTool on that platform; gate its construction/registration with #[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))].
  2. If the platform has a working opener (e.g. 'open' on FreeBSD when the xdg-open port is installed), treat it as Linux-like and add a cfg branch upstream.
  3. Route URL-opening through a channel message instead of the local browser on unsupported OSes.

Example fix

// before: tool registered unconditionally
tools.push(BrowserOpenTool::new(security, domains)?.into());

// after: only on supported desktop platforms
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
tools.push(BrowserOpenTool::new(security, domains)?.into());
Defensive patterns

Strategy: validation

Validate before calling

// Compile-time gate: never construct the tool on unsupported platforms.
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
fn register_browser_tool(tools: &mut Vec<Box<dyn Tool>>, security: Arc<SecurityPolicy>, domains: Vec<String>) -> anyhow::Result<()> {
    tools.push(BrowserOpenTool::new(security, domains)?.into());
    Ok(())
}

#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
fn register_browser_tool(_tools: &mut Vec<Box<dyn Tool>>, _security: Arc<SecurityPolicy>, _domains: Vec<String>) -> anyhow::Result<()> {
    Ok(())
}

Prevention

When it happens

Trigger: Running the zeroclaw runtime with BrowserOpenTool registered on FreeBSD, OpenBSD, Solaris/illumos, or a non-desktop target like android/ios that is not macos/linux/windows at compile time.

Common situations: Cross-compiling or deploying the agent to BSD-based servers or niche Unix flavors where the tool registry was copied over wholesale without platform gating.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/f609efb6ee0bbbf7. Report an issue: GitHub.