BoundaryML/baml · warning

InternalError

InternalError

Error message

Failed to open browser: {}

What it means

The execute_command handler (e.g. a 'open docs/webview' command) attempted to launch the system browser; when that fails, the server both shows a WARNING message to the user and returns this InternalError containing the OS-level failure in `{e}`.

Source

Thrown at engine/language_server/src/server/api/requests/execute_command.rs:71

                Some(name) => format!(
                    "http://localhost:{}?function={}",
                    session.playground_port,
                    utf8_percent_encode(name, NON_ALPHANUMERIC)
                ),
                None => format!("http://localhost:{}", session.playground_port),
            };

            // Open the browser
            if let Err(e) = webbrowser::open(&url) {
                notifier
                    .notify::<lsp_types::notification::ShowMessage>(lsp_types::ShowMessageParams {
                        typ: MessageType::WARNING,
                        message: format!("Failed to open browser: {e}"),
                    })
                    .internal_error()?;
                return Err(crate::server::api::Error {
                    code: ErrorCode::InternalError,
                    error: anyhow::anyhow!("Failed to open browser: {}", e),
                });
            }

            let _ = session
                .to_webview_router_tx
                .send(WebviewRouterMessage::SendMessageToWebview(
                    playground_server::WebviewCommand::LspMessage(Notification::new(
                        "workspace/executeCommand".to_string(),
                        json!(params),
                    )),
                ))
                .inspect_err(|e| {
                    tracing::error!(
                        "Failed to send SEND_MESSAGE_TO_WEBVIEW message to webview: {e}"
                    );
                });
            return Ok(None);
        }

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Set/verify the system default browser or install xdg-open (Linux: xdg-utils).
  2. Run the editor locally instead of in a headless/remote shell so a browser exists.
  3. Open the docs URL manually in a browser; the command's failure is cosmetic to BAML functionality.
  4. Check the embedded `{e}` for the exact OS error (e.g. 'No application is registered as handling this file type').

Example fix

// before: headless container
$ which xdg-open  # not found
// after: install opener
$ apt-get install -y xdg-utils
Defensive patterns

Strategy: fallback

Try / catch

// Caller-side: tolerate browser-open failure
match execute_open_browser(session) {
    Err(e) => show_warning(&format!("Open the URL manually: {e}")),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: `execute_command` request triggers browser opening (webview/docs flow) and the open-browser call returns Err — no browser registered, headless environment, or sandboxed OS blocking xdg-open/open.

Common situations: Running VS Code over SSH/remote without a local browser; Linux servers without xdg-open; CI/devcontainers with no display or default browser.

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 BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/6891893c3d9d2d35. Report an issue: GitHub.