{"record":{"id":"6891893c3d9d2d35","repo":"BoundaryML/baml","slug":"internalerror-failed-to-open-browser","errorCode":"InternalError","errorMessage":"Failed to open browser: {}","messagePattern":"Failed to open browser: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"engine/language_server/src/server/api/requests/execute_command.rs","lineNumber":71,"sourceCode":"                Some(name) => format!(\n                    \"http://localhost:{}?function={}\",\n                    session.playground_port,\n                    utf8_percent_encode(name, NON_ALPHANUMERIC)\n                ),\n                None => format!(\"http://localhost:{}\", session.playground_port),\n            };\n\n            // Open the browser\n            if let Err(e) = webbrowser::open(&url) {\n                notifier\n                    .notify::<lsp_types::notification::ShowMessage>(lsp_types::ShowMessageParams {\n                        typ: MessageType::WARNING,\n                        message: format!(\"Failed to open browser: {e}\"),\n                    })\n                    .internal_error()?;\n                return Err(crate::server::api::Error {\n                    code: ErrorCode::InternalError,\n                    error: anyhow::anyhow!(\"Failed to open browser: {}\", e),\n                });\n            }\n\n            let _ = session\n                .to_webview_router_tx\n                .send(WebviewRouterMessage::SendMessageToWebview(\n                    playground_server::WebviewCommand::LspMessage(Notification::new(\n                        \"workspace/executeCommand\".to_string(),\n                        json!(params),\n                    )),\n                ))\n                .inspect_err(|e| {\n                    tracing::error!(\n                        \"Failed to send SEND_MESSAGE_TO_WEBVIEW message to webview: {e}\"\n                    );\n                });\n            return Ok(None);\n        }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_server/src/server/api/requests/execute_command.rs#L53-L89","documentation":"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}`.","triggerScenarios":"`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.","commonSituations":"Running VS Code over SSH/remote without a local browser; Linux servers without xdg-open; CI/devcontainers with no display or default browser.","solutions":["Set/verify the system default browser or install xdg-open (Linux: xdg-utils).","Run the editor locally instead of in a headless/remote shell so a browser exists.","Open the docs URL manually in a browser; the command's failure is cosmetic to BAML functionality.","Check the embedded `{e}` for the exact OS error (e.g. 'No application is registered as handling this file type')."],"exampleFix":"// before: headless container\n$ which xdg-open  # not found\n// after: install opener\n$ apt-get install -y xdg-utils","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Caller-side: tolerate browser-open failure\nmatch execute_open_browser(session) {\n    Err(e) => show_warning(&format!(\"Open the URL manually: {e}\")),\n    Ok(_) => {}\n}","preventionTips":["Install a default browser / xdg-open in the environment running the editor.","Avoid headless remotes for commands that need a browser.","Copy the docs URL from logs when browser launch fails."],"tags":["lsp","browser","execute-command","baml"],"backgroundTag":"unsupported-platform","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}