{"record":{"id":"346c4a2cb6455b3b","repo":"RightNow-AI/openfang","slug":"navigate-failed-e","errorCode":null,"errorMessage":"Navigate failed: {e}","messagePattern":"Navigate failed: (.+?)","errorType":"http","errorClass":"BrowserResponse","httpStatus":null,"severity":"error","filePath":"crates/openfang-runtime/src/browser.rs","lineNumber":425,"sourceCode":"            BrowserCommand::Wait {\n                selector,\n                timeout_ms,\n            } => self.cmd_wait(&selector, timeout_ms).await,\n            BrowserCommand::RunJs { expression } => self.cmd_run_js(&expression).await,\n            BrowserCommand::Back => self.cmd_back().await,\n        }\n    }\n\n    // ── Command implementations ────────────────────────────────────────\n\n    async fn cmd_navigate(&self, url: &str) -> BrowserResponse {\n        let result = self\n            .cdp\n            .send(\"Page.navigate\", serde_json::json!({ \"url\": url }))\n            .await;\n\n        if let Err(e) = result {\n            return BrowserResponse::err(format!(\"Navigate failed: {e}\"));\n        }\n\n        // Wait for page load\n        self.wait_for_load().await;\n\n        match self.page_info().await {\n            Ok(info) => BrowserResponse::ok(info),\n            Err(e) => BrowserResponse::err(format!(\"Navigate succeeded but page info failed: {e}\")),\n        }\n    }\n\n    async fn cmd_click(&self, selector: &str) -> BrowserResponse {\n        let sel_json = serde_json::to_string(selector).unwrap_or_default();\n        let js = format!(\n            r#\"(() => {{\n    let sel = {sel_json};\n    let el = document.querySelector(sel);\n    if (!el) {{","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/RightNow-AI/openfang/blob/acf2587e46be174c10200489c9a2d23a39a98aeb/crates/openfang-runtime/src/browser.rs#L407-L443","documentation":"cmd_navigate in openfang-runtime's browser module drives a headless browser over the Chrome DevTools Protocol (CDP). It sends a \"Page.navigate\" command with the target URL; if the CDP transport returns an Err (browser not running, connection dropped, IPC/WS failure, or navigation rejected), the error is wrapped into this message and returned as an error BrowserResponse instead of panicking.","triggerScenarios":"Calling navigate (via the runtime execute dispatch) when the CDP connection in self.cdp cannot deliver the \"Page.navigate\" command: browser process died, connection never established, or the CDP send future resolves to Err.","commonSituations":"Chrome/Chromium was closed or crashed between commands; the runtime was constructed without a live browser session; invalid URL scheme the browser refuses; resource exhaustion killing the headless process.","solutions":["Check the browser/CDP process is running and reconnect (reinitialize the browser session) before retrying.","Verify the URL is absolute and well-formed (include https:// scheme).","Inspect the inner CDP error text in the message for transport diagnostics (e.g. connection refused).","Add retry-with-backoff around navigate for transient connection drops."],"exampleFix":"// before\nlet result = self.cdp.send(\"Page.navigate\", serde_json::json!({ \"url\": url })).await;\n// after\nif !url.starts_with(\"http://\") && !url.starts_with(\"https://\") {\n    return BrowserResponse::err(format!(\"Invalid URL: {url}\"));\n}\nlet result = self.cdp.send(\"Page.navigate\", serde_json::json!({ \"url\": url })).await;","handlingStrategy":"retry","validationCode":"// Rust\nfn is_navigable(url: &str) -> bool {\n    url.starts_with(\"http://\") || url.starts_with(\"https://\")\n}\nif !is_navigable(url) { return Err(anyhow!(\"invalid url: {url}\")); }","typeGuard":"fn is_transport_err(resp: &BrowserResponse) -> bool {\n    !resp.success && resp.error.contains(\"connection\") || !resp.success && resp.error.contains(\"closed\")\n}","tryCatchPattern":"// Rust\nmatch browser.execute(\"navigate\", url).await {\n    Ok(r) if r.success => Ok(r),\n    Ok(r) => Err(anyhow!(r.error)),\n    Err(e) if e.to_string().contains(\"connection\") => {\n        browser.reconnect().await?;\n        browser.execute(\"navigate\", url).await.map_err(Into::into)\n    }\n    Err(e) => Err(e.into()),\n}","preventionTips":["Health-check the CDP connection before each navigation batch.","Always pass absolute URLs with an explicit scheme.","Keep the headless browser process supervised so crashes are detected early.","Retry transient transport errors with exponential backoff."],"tags":["cdp","navigation","browser-automation"],"backgroundTag":"cdp-command-failed","analyzedSha":"acf2587e46be174c10200489c9a2d23a39a98aeb","analyzedAt":"2026-09-02T22:42:28.464Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}