RightNow-AI/openfang · warning · BrowserResponse

Navigate succeeded but page info failed: {e}

Error message

Navigate succeeded but page info failed: {e}

What it means

After a successful Page.navigate and wait_for_load, cmd_navigate calls page_info() to fetch the current page metadata (URL/title). If that CDP-backed call fails, this error distinguishes 'navigation worked but introspection failed' from a plain navigation failure, so the caller knows the page may actually be loaded.

Source

Thrown at crates/openfang-runtime/src/browser.rs:433

    // ── Command implementations ────────────────────────────────────────

    async fn cmd_navigate(&self, url: &str) -> BrowserResponse {
        let result = self
            .cdp
            .send("Page.navigate", serde_json::json!({ "url": url }))
            .await;

        if let Err(e) = result {
            return BrowserResponse::err(format!("Navigate failed: {e}"));
        }

        // Wait for page load
        self.wait_for_load().await;

        match self.page_info().await {
            Ok(info) => BrowserResponse::ok(info),
            Err(e) => BrowserResponse::err(format!("Navigate succeeded but page info failed: {e}")),
        }
    }

    async fn cmd_click(&self, selector: &str) -> BrowserResponse {
        let sel_json = serde_json::to_string(selector).unwrap_or_default();
        let js = format!(
            r#"(() => {{
    let sel = {sel_json};
    let el = document.querySelector(sel);
    if (!el) {{
        const all = document.querySelectorAll('a, button, [role="button"], input[type="submit"], [onclick]');
        const lower = sel.toLowerCase();
        for (const e of all) {{
            if (e.textContent.trim().toLowerCase().includes(lower)) {{ el = e; break; }}
        }}
    }}
    if (!el) return JSON.stringify({{success: false, error: 'Element not found: ' + sel}});
    el.scrollIntoView({{block: 'center'}});

View on GitHub (pinned to acf2587e46)

Solutions

  1. Retry page_info after a short delay — the page may still be settling after load.
  2. Treat the navigation as successful and read the URL/title via a separate, retried CDP call.
  3. Increase wait_for_load tolerance or poll for document.readyState before querying page info.
  4. Check the inner error for 'context destroyed' style messages indicating a page crash.

Example fix

// before
match self.page_info().await {
    Ok(info) => BrowserResponse::ok(info),
    Err(e) => BrowserResponse::err(format!("Navigate succeeded but page info failed: {e}")),
}
// after
match self.page_info().await {
    Ok(info) => BrowserResponse::ok(info),
    Err(_) => {
        tokio::time::sleep(std::time::Duration::from_millis(500)).await;
        match self.page_info().await {
            Ok(info) => BrowserResponse::ok(info),
            Err(e) => BrowserResponse::err(format!("Navigate succeeded but page info failed: {e}")),
        }
    }
}
Defensive patterns

Strategy: fallback

Type guard

fn page_info_available(resp: &BrowserResponse) -> bool {
    resp.success && resp.value.get("url").is_some()
}

Try / catch

// Rust
match browser.execute("navigate", url).await {
    Ok(r) if r.success && r.value.get("url").is_some() => Ok(r),
    Ok(r) if r.success => {
        // navigation worked, page_info failed — retry info once, else continue
        tokio::time::sleep(Duration::from_millis(500)).await;
        browser.execute("page_info", "").await.map_err(Into::into)
    }
    Ok(r) => Err(anyhow!(r.error)),
    Err(e) => Err(e.into()),
}

Prevention

When it happens

Trigger: Page.navigate succeeded and wait_for_load completed, but self.page_info().await returned Err — typically a CDP evaluation failure while collecting page info (e.g. page navigated again, crashed, or context destroyed mid-query).

Common situations: SPA redirects or meta-refresh firing after load completes; page crash (out of memory) right after navigation; extension/script destroying the JS context during page_info evaluation.

Related errors


AI-assisted analysis of RightNow-AI/openfang@acf2587e46 (2026-09-02). Data as JSON: /api/errors/9d66dda7c9be9ec6. Report an issue: GitHub.