{"record":{"id":"4404b40a0e74a04b","repo":"BigPizzaV3/CodexPlusPlus","slug":"no-injectable-codex-page-target-found","errorCode":null,"errorMessage":"No injectable Codex page target found","messagePattern":"No injectable Codex page target found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/cdp.rs","lineNumber":270,"sourceCode":"    bail!(\"No injectable page target found\")\n}\n\npub fn pick_injectable_codex_page_target(targets: &[CdpTarget]) -> anyhow::Result<CdpTarget> {\n    let priorities: [fn(&CdpTarget) -> bool; 4] = [\n        is_exact_codex_app_main_target,\n        is_primary_codex_app_target,\n        is_chatgpt_desktop_page_target,\n        is_supported_codex_page_target,\n    ];\n    for matches_priority in priorities {\n        if let Some(target) = targets\n            .iter()\n            .find(|target| is_injectable_page_target(target) && matches_priority(target))\n        {\n            return Ok(target.clone());\n        }\n    }\n    bail!(\"No injectable Codex page target found\")\n}\n\nfn is_codex_app_page_target(target: &CdpTarget) -> bool {\n    let Ok(url) = reqwest::Url::parse(target.url.trim()) else {\n        return false;\n    };\n    url.scheme().eq_ignore_ascii_case(\"app\")\n        && url.host_str() == Some(\"-\")\n        && url.path().eq_ignore_ascii_case(\"/index.html\")\n}\n\npub fn is_injectable_page_target(target: &CdpTarget) -> bool {\n    target.target_type == \"page\"\n        && target\n            .web_socket_debugger_url\n            .as_deref()\n            .is_some_and(|url| !url.is_empty())\n}","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/cdp.rs#L252-L288","documentation":"Thrown by `pick_injectable_codex_page_target` when no injectable page target matches any of the Codex-specific priority predicates (exact Codex app main target, primary Codex app target, etc.). Unlike `pick_page_target`, this requires the target to actually look like the Codex app page.","triggerScenarios":"Calling `pick_injectable_codex_page_target` when the target list contains only non-Codex pages (other sites, embedded browser pages that merely have 'codex' in their title but are classified as embedded/standalone, or non-page targets).","commonSituations":"The Codex app tab isn't open yet in the embedded browser, the user navigated the Codex tab away to another URL, or the app window was closed so only unrelated pages remain.","solutions":["Open or re-focus the Codex app page in the embedded browser so a matching target exists","Fall back to `pick_page_target` if any injectable page is acceptable for your use case","Re-run `list_targets` first — the target list may be stale relative to the current browser state","Verify the page's URL/title against the `is_codex_app_page_target` predicates to see why your page doesn't match"],"exampleFix":"// before\nlet target = cdp::pick_injectable_codex_page_target(&targets)?; // codex tab closed\n// after\nlet target = match cdp::pick_injectable_codex_page_target(&targets) {\n    Ok(t) => t,\n    Err(_) => cdp::pick_page_target(&targets)?, // lenient fallback\n};","handlingStrategy":"fallback","validationCode":"fn has_codex_page(targets: &[CdpTarget]) -> bool {\n    targets.iter().any(|t| t.target_type == \"page\" && t.url.contains(\"codex\"))\n}","typeGuard":null,"tryCatchPattern":"let target = match cdp::pick_injectable_codex_page_target(&targets) {\n    Ok(t) => t,\n    Err(_) => cdp::pick_page_target(&targets).context(\"no Codex page open; open the app tab first\")?,\n};","preventionTips":["Open the Codex app page in the embedded browser before injection","Handle the case where the user navigated the Codex tab away","Fall back to pick_page_target when strict Codex matching isn't required"],"tags":["cdp","target-selection","codex"],"backgroundTag":"resource-not-found","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}