{"record":{"id":"13e4e1ef1582dde6","repo":"BigPizzaV3/CodexPlusPlus","slug":"selected-cdp-target-has-no-websocket-url","errorCode":null,"errorMessage":"selected CDP target has no websocket URL","messagePattern":"selected CDP target has no websocket URL","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/codex-plus-launcher/src/main.rs","lineNumber":1049,"sourceCode":"    request: &codex_plus_core::remote_control_recovery::PendingRemoteControlRecovery,\n) -> bool {\n    settings.active_relay_id == request.profile_id\n        && settings.active_relay_session_provider()\n            == codex_plus_core::settings::RelaySessionProvider::Openai\n}\n\nasync fn try_inject_with_context(\n    debug_port: u16,\n    helper_port: u16,\n    ctx: BridgeContext,\n    runtime: Arc<LauncherRuntimeService>,\n) -> anyhow::Result<()> {\n    let targets = codex_plus_core::cdp::list_targets(debug_port).await?;\n    let target = codex_plus_core::cdp::pick_injectable_codex_page_target(&targets)?;\n    let websocket_url = target\n        .web_socket_debugger_url\n        .as_deref()\n        .ok_or_else(|| anyhow::anyhow!(\"selected CDP target has no websocket URL\"))?;\n    runtime.set_websocket_url(websocket_url);\n    let settings = codex_plus_core::settings::SettingsStore::default()\n        .load()\n        .unwrap_or_default();\n    let script = codex_plus_core::assets::injection_script_with_settings(helper_port, &settings);\n    let user_bundle = runtime\n        .user_scripts\n        .build_enabled_bundle()\n        .unwrap_or_default();\n    let new_document_scripts = if user_bundle.is_empty() {\n        vec![script]\n    } else {\n        vec![script, user_bundle]\n    };\n    codex_plus_core::bridge::install_bridge(\n        websocket_url,\n        codex_plus_core::bridge::BRIDGE_BINDING_NAME,\n        Arc::new(move |path, payload| {","sourceCodeStart":1031,"sourceCodeEnd":1067,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/apps/codex-plus-launcher/src/main.rs#L1031-L1067","documentation":"After listing CDP targets and picking an injectable Codex page target, the launcher reads target.web_socket_debugger_url to attach a WebSocket for script injection. This error is thrown with ok_or_else when that optional field is None — the selected target exists but the DevTools handshake URL the debugger would connect to is absent, so injection cannot proceed.","triggerScenarios":"codex_plus_core::cdp::pick_injectable_codex_page_target returned a target whose web_socket_debugger_url field is None — e.g. the /json target list contained an entry without a webSocketDebuggerUrl (about:blank, still-loading page, or a non-page target that slipped through the picker).","commonSituations":"Attaching to a browser page before it finished loading (DevTools WS URL not yet assigned), targeting browsers that omit webSocketDebuggerUrl for certain targets, or a picker filter that matches more target kinds than the CDP implementation supports.","solutions":["Re-list CDP targets and retry until the chosen page exposes webSocketDebuggerUrl (page fully loaded)","Tighten pick_injectable_codex_page_target to only select targets guaranteed to have a WS URL","Confirm the browser version supports webSocketDebuggerUrl on /json targets","Navigate the Codex page manually first, then rerun injection"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn target_has_ws_url(t: &codex_plus_core::cdp::Target) -> bool {\n    t.web_socket_debugger_url.as_deref().map_or(false, |u| u.starts_with(\"ws\"))\n}\n// 注入前：只挑选带 WS URL 的可注入 target\nlet target = targets.iter().find(|t| target_has_ws_url(t));","typeGuard":"fn has_websocket_url(target: &Target) -> Option<&str> {\n    target.web_socket_debugger_url.as_deref().filter(|u| !u.is_empty())\n}","tryCatchPattern":null,"preventionTips":["Re-list /json targets and pick again if the chosen page lacks webSocketDebuggerUrl (page still loading)","Filter targets to fully-loaded page targets before injection","Pin to browser versions known to always emit webSocketDebuggerUrl for page targets","Log the full target list on failure to spot which target kinds lack WS URLs"],"tags":["rust","cdp","websocket","browser-automation"],"backgroundTag":"empty-required-field","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"}