BigPizzaV3/CodexPlusPlus · error · anyhow::Error

No injectable Codex page target found

Error message

No injectable Codex page target found

What it means

pick_injectable_codex_page_target is the stricter picker: it walks four priority predicates (exact Codex app main target, primary Codex app target, ChatGPT desktop page, other supported Codex page) and requires the target to be injectable (type page plus ws URL). This error means injectable pages existed, but none looked like a Codex or ChatGPT surface — for example only an embedded browser page named codex or the standalone manager window, which are deliberately ignored.

Source

Thrown at crates/codex-plus-core/src/cdp.rs:270

    bail!("No injectable page target found")
}

pub fn pick_injectable_codex_page_target(targets: &[CdpTarget]) -> anyhow::Result<CdpTarget> {
    let priorities: [fn(&CdpTarget) -> bool; 4] = [
        is_exact_codex_app_main_target,
        is_primary_codex_app_target,
        is_chatgpt_desktop_page_target,
        is_supported_codex_page_target,
    ];
    for matches_priority in priorities {
        if let Some(target) = targets
            .iter()
            .find(|target| is_injectable_page_target(target) && matches_priority(target))
        {
            return Ok(target.clone());
        }
    }
    bail!("No injectable Codex page target found")
}

fn is_codex_app_page_target(target: &CdpTarget) -> bool {
    let Ok(url) = reqwest::Url::parse(target.url.trim()) else {
        return false;
    };
    url.scheme().eq_ignore_ascii_case("app")
        && url.host_str() == Some("-")
        && url.path().eq_ignore_ascii_case("/index.html")
}

pub fn is_injectable_page_target(target: &CdpTarget) -> bool {
    target.target_type == "page"
        && target
            .web_socket_debugger_url
            .as_deref()
            .is_some_and(|url| !url.is_empty())
}

View on GitHub (pinned to f2074595a2)

Solutions

  1. Open and fully load the Codex app window (or a ChatGPT desktop page) before selecting a target
  2. If Codex-specific matching is not required, fall back to pick_page_target which accepts any injectable page
  3. Print the target list and compare each url and title against the predicates the crate matches on
  4. After a Codex app update, adjust the matching predicates or file an issue with the target dump

Example fix

// before
let target = pick_injectable_codex_page_target(&targets)?;
// after: fall back to any injectable page when no Codex surface is open
let target = pick_injectable_codex_page_target(&targets)
    .or_else(|_| pick_page_target(&targets))?;
Defensive patterns

Strategy: fallback

Validate before calling

let codex_open = targets.iter().any(|t| t.url.trim().to_ascii_lowercase().contains("codex"));
if !codex_open { /* launch or focus the Codex app before selecting */ }

Type guard

fn looks_like_codex_surface(target: &CdpTarget) -> bool {
    let url = target.url.trim().to_ascii_lowercase();
    url.starts_with("app://") || url.contains("chatgpt") || url.contains("codex")
}

Try / catch

let target = match pick_injectable_codex_page_target(&targets) {
    Ok(t) => t,
    Err(_) => pick_page_target(&targets)?, // lenient fallback: any injectable page
};

Prevention

When it happens

Trigger: Calling pick_injectable_codex_page_target with a target list that contains no app-scheme Codex window and no ChatGPT desktop page: the user closed the Codex app, only the Codex++ manager window is open, or the open page matches the ignored embedded-browser/standalone-manager set.

Common situations: Codex desktop app not launched or stuck on a blank window; testing against about-blank or chrome pages; a Codex app update changed the target url or title shape so no predicate matches.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/4404b40a0e74a04b. Report an issue: GitHub.