{"record":{"id":"3baf9ce7103d8c9e","repo":"Kuberwastaken/claurst","slug":"no-debuggable-page-found-on-port-make-sure-chr","errorCode":null,"errorMessage":"No debuggable page found on port {}. Make sure Chrome has at least one open tab.","messagePattern":"No debuggable page found on port (.+?)\\. Make sure Chrome has at least one open tab\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-rust/crates/commands/src/chrome.rs","lineNumber":129,"sourceCode":"\r\n    /// Connect to Chrome at the given port.\r\n    /// Picks the first available target (tab/page).\r\n    pub async fn connect(port: u16) -> anyhow::Result<String> {\r\n        let http_url = format!(\"http://localhost:{}/json/list\", port);\r\n        let client = reqwest::Client::builder()\r\n            .timeout(std::time::Duration::from_secs(3))\r\n            .build()?;\r\n        let tabs: Value = client.get(&http_url).send().await?.json().await?;\r\n\r\n        let ws_url = tabs\r\n            .as_array()\r\n            .and_then(|arr| {\r\n                arr.iter().find(|t| t[\"type\"] == \"page\").and_then(|t| {\r\n                    t[\"webSocketDebuggerUrl\"].as_str().map(|s| s.to_string())\r\n                })\r\n            })\r\n            .ok_or_else(|| {\r\n                anyhow::anyhow!(\r\n                    \"No debuggable page found on port {}. \\\r\n                     Make sure Chrome has at least one open tab.\",\r\n                    port\r\n                )\r\n            })?;\r\n\r\n        let tab_url = tabs\r\n            .as_array()\r\n            .and_then(|arr| {\r\n                arr.iter()\r\n                    .find(|t| t[\"type\"] == \"page\")\r\n                    .and_then(|t| t[\"url\"].as_str().map(|s| s.to_string()))\r\n            })\r\n            .unwrap_or_default();\r\n\r\n        let (ws, _) = connect_async(&ws_url).await.map_err(|e| {\r\n            anyhow::anyhow!(\"WebSocket connect to {} failed: {}\", ws_url, e)\r\n        })?;\r","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/Kuberwastaken/claurst/blob/b0637c97ec34144387cbf2f74f65df6d16a6cef1/src-rust/crates/commands/src/chrome.rs#L111-L147","documentation":"Thrown by `connect` when querying Chrome's DevTools HTTP endpoint (`/json` list of targets) yields no target of type \"page\" with a webSocketDebuggerUrl. Chrome is reachable on the debug port but exposes no debuggable page target, so the library cannot obtain a CDP WebSocket URL and aborts the connect.","triggerScenarios":"Chrome runs with --remote-debugging-port but has zero open tabs (all closed, only background/service-worker targets present); the target list JSON has no entry whose `type` equals \"page\" or whose `webSocketDebuggerUrl` field is absent.","commonSituations":"Headless Chrome started without an initial URL and all tabs closed; Chrome started with a --remote-debugging-port only reachable in new window modes where no page target exists yet; enterprise Chrome policies hiding debug targets.","solutions":["Open at least one normal tab in the Chrome instance being debugged.","Restart Chrome with --remote-debugging-port=<port> and an initial URL so a page target exists.","Verify with `curl http://127.0.0.1:<port>/json` that a target with \"type\":\"page\" and webSocketDebuggerUrl appears.","Re-run `/chrome connect` after the tab is open."],"exampleFix":"// before: chrome started with no tabs\n// http://127.0.0.1:9222/json returns only service workers\n\n// after: start chrome with an initial page\n// chrome --remote-debugging-port=9222 https://example.com","handlingStrategy":"retry","validationCode":"let targets: Value = reqwest::get(format!(\"http://127.0.0.1:{}/json\", port)).await?.json().await?;\nlet ok = targets.as_array().map(|a| a.iter().any(|t| t[\"type\"] == \"page\" && t.get(\"webSocketDebuggerUrl\").is_some())).unwrap_or(false);\nif !ok { /* open a tab or restart Chrome */ }","typeGuard":"fn has_page_target(targets: &Value) -> bool {\n    targets.as_array().is_some_and(|a| a.iter().any(|t| t[\"type\"] == \"page\" && t[\"webSocketDebuggerUrl\"].is_string()))\n}","tryCatchPattern":"match connect(port).await {\n    Ok(_) => {},\n    Err(e) if e.to_string().contains(\"No debuggable page\") => {\n        open_new_tab(port)?;\n        connect(port).await?;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Start Chrome with an initial URL so a page target always exists.","Verify /json output shows a \"type\":\"page\" target before connecting.","Avoid closing all tabs in a debugged Chrome instance."],"tags":["chrome","cdp","devtools-protocol","websocket"],"backgroundTag":"empty-result-set","analyzedSha":"b0637c97ec34144387cbf2f74f65df6d16a6cef1","analyzedAt":"2026-09-10T00:24:58.650Z","contentChangedAt":"2026-09-10T00:24:58.650Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}