BigPizzaV3/CodexPlusPlus · error
No DevTools target configured
Error message
No DevTools target configured
What it means
open_devtools opens a Chrome DevTools window for the embedded browser session, which requires a DevTools target id captured when the session started. If self.devtools_target_id is None (the field is only set during session startup with debugging enabled), the method returns this error rather than guessing a target. It is an invalid-state condition, not an invalid argument.
Solutions
- Start/launch a browser session with DevTools (remote debugging port) enabled before calling open_devtools.
- Check/queue the action in the UI only when the DevTools target exists (disable the button otherwise).
- If the session should have a target, verify the browser launch path sets devtools_target_id and that a restart did not clear it.
- Re-launch the session to repopulate the target, then retry.
Example fix
// before
await openDevtools();
// after
if (!session.devtoolsTargetId) {
throw new Error('DevTools target not configured; start a debug session first');
}
await openDevtools(); Defensive patterns
Strategy: type-guard
Validate before calling
// Only enable the DevTools action when a debug session target exists const canOpenDevtools = Boolean(session?.devtoolsTargetId);
Type guard
function hasDevtoolsTarget(s: { devtoolsTargetId?: string | null }): s is { devtoolsTargetId: string } {
return typeof s.devtoolsTargetId === 'string' && s.devtoolsTargetId.length > 0;
} Try / catch
try {
await api.openDevtools();
} catch (e) {
if (String(e).includes('No DevTools target configured')) {
promptUserToStartDebugSession();
} else { throw e; }
} Prevention
- Gate the DevTools UI action on an active debug session.
- Clear/disable the action on session teardown.
- Persist devtools target state across app restarts if needed.
- Ensure browser launch always sets the target id when debugging is on.
When it happens
Trigger: Calling open_devtools before any session with DevTools enabled has been launched; calling it after session teardown cleared the target id; launching the browser with remote debugging disabled so no target was ever recorded.
Common situations: User clicks 'Open DevTools' in the manager UI before starting a proxied browser session; app restarted and lost in-memory target state.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- CDP command id failed
- CDP websocket closed before response for
- 启动系统浏览器失败:
- failed to open DevTools URL
- invalid built-in Dream Skin theme draft
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/2f92914ca2109aac.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/routes.rs:450
async fn reload_user_scripts(&self) -> anyhow::Result<Value> {
if let (Some(user_scripts), Some(websocket_url), Some(evaluator)) = (
&self.user_scripts,
self.websocket_url.as_deref(),
&self.user_script_evaluator,
) {
let bundle = user_scripts.build_enabled_bundle()?;
if !bundle.trim().is_empty() {
evaluator(websocket_url, &bundle)?;
}
}
self.user_script_inventory().await
}
async fn open_devtools(&self) -> anyhow::Result<Value> {
let target_id = self
.devtools_target_id
.as_deref()
.ok_or_else(|| anyhow::anyhow!("No DevTools target configured"))?;
let url = devtools_url(self.debug_port, target_id);
if let Some(opener) = &self.devtools_opener {
opener(&url)?;
}
Ok(json!({
"status": "ok",
"target_id": target_id,
"url": url
}))
}
async fn open_manager(&self, payload: Value) -> anyhow::Result<Value> {
let navigation =
crate::manager_navigation::save_pending_manager_navigation_from_payload(&payload)?;
let target = crate::install::open_or_activate_manager().map_err(|error| {
crate::manager_navigation::rollback_pending_manager_navigation_after_launch_failure(
navigation.as_ref(),
error,View on GitHub (pinned to b1ed92e5e4)