{"record":{"id":"bbb6f66e87a55437","repo":"openai/codex","slug":"remote-control-requires-chatgpt-authentication-ap","errorCode":null,"errorMessage":"remote control requires ChatGPT authentication; API key auth is not supported","messagePattern":"remote control requires ChatGPT authentication; API key auth is not supported","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/app-server-transport/src/transport/remote_control/auth.rs","lineNumber":65,"sourceCode":"                ));\n            }\n            auth_manager.reload().await;\n            reloaded = true;\n            continue;\n        };\n        if !auth.uses_codex_backend() {\n            break auth;\n        }\n        if auth.get_account_id().is_none() && !reloaded {\n            auth_manager.reload().await;\n            reloaded = true;\n            continue;\n        }\n        break auth;\n    };\n\n    if !auth.uses_codex_backend() {\n        return Err(io::Error::new(\n            ErrorKind::PermissionDenied,\n            \"remote control requires ChatGPT authentication; API key auth is not supported\",\n        ));\n    }\n\n    Ok(RemoteControlConnectionAuth {\n        auth_provider: codex_model_provider::auth_provider_from_auth(&auth),\n        account_id: auth.get_account_id().ok_or_else(|| {\n            io::Error::new(\n                ErrorKind::WouldBlock,\n                \"remote control enrollment is waiting for a ChatGPT account id\",\n            )\n        })?,\n    })\n}\n\npub(super) async fn recover_remote_control_auth(\n    auth_recovery: &mut UnauthorizedRecovery,","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/app-server-transport/src/transport/remote_control/auth.rs#L47-L83","documentation":"Auth loaded successfully but does not use the Codex/ChatGPT backend — typically API-key authentication. Remote control is a ChatGPT-account feature: it needs the ChatGPT account id header and pairing identity that API-key auth cannot supply, so load_remote_control_auth rejects it with PermissionDenied before any network call.","triggerScenarios":"Any remote-control call (pairing, client list/revoke, persist_preference, enrollment refresh) while auth.uses_codex_backend() is false — OPENAI_API_KEY set in the environment, or the preferred auth method resolving to API key, so auth.json holds key-based auth.","commonSituations":"Developers who usually drive Codex with an API key enable remote control for the first time; CI images injecting OPENAI_API_KEY globally; switching auth mode in config without re-logging in; org defaults that force key auth.","solutions":["Log out and run codex login choosing Sign in with ChatGPT so auth.json holds ChatGPT auth","Unset OPENAI_API_KEY and remove apiKey from preferred-auth-method config so ChatGPT auth is selected","Retry the remote-control call after confirming the session is ChatGPT-backed"],"exampleFix":"// before\nexport OPENAI_API_KEY=sk-...\ncodex remote-control pair\n// Err: remote control requires ChatGPT authentication; API key auth is not supported\n\n// after\nunset OPENAI_API_KEY\ncodex login   # 'Sign in with ChatGPT'\ncodex remote-control pair   // Ok","handlingStrategy":"validation","validationCode":"if let Some(auth) = auth_manager.auth().await {\n    if !auth.uses_codex_backend() {\n        // disable remote-control actions and prompt ChatGPT sign-in\n    }\n}","typeGuard":null,"tryCatchPattern":"Match PermissionDenied whose message contains 'API key auth is not supported' and offer a 'switch to ChatGPT sign-in' action. The error is deterministic — retrying without changing auth mode always fails.","preventionTips":["Feature-gate remote control on auth mode, not merely on auth presence","Document that OPENAI_API_KEY and remote control are mutually exclusive","In account pickers, filter to ChatGPT-backed accounts for remote-control actions"],"tags":["authentication","api-key","chatgpt","remote-control","permission-denied"],"backgroundTag":"unsupported-auth-method","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}