openai/codex · error · anyhow::Error
ChatGPT backend requests require Codex backend auth
Error message
ChatGPT backend requests require Codex backend auth
What it means
Ensure guard at the top of read_connector_metadata: the provided auth snapshot does not use the Codex backend, so the apps/connector metadata POST would be unauthorized. Checking up front keeps the store from committing results requested under the wrong backend scope.
Solutions
- Pass a CodexAuth snapshot obtained via Codex-backend login
- Feature-gate connector metadata reads on uses_codex_backend()
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/chatgpt/src/connectors.rs:143 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/a618bf21f6da2fb5.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/chatgpt/src/connectors.rs:143
))
}
pub struct ConnectorMetadataReadResult {
pub apps: Vec<ConnectorMetadata>,
pub missing_app_ids: Vec<String>,
}
/// Reads display metadata without loading MCP connector tools or runtime state.
///
/// The store is created before awaiting the backend request, so a response that arrives after an
/// account or backend change can only commit to the scope under which it was requested.
pub async fn read_connector_metadata(
config: &Config,
auth: &CodexAuth,
app_ids: &[String],
include_tools: bool,
) -> anyhow::Result<ConnectorMetadataReadResult> {
anyhow::ensure!(
auth.uses_codex_backend(),
"ChatGPT backend requests require Codex backend auth"
);
anyhow::ensure!(
auth.get_account_id().is_some(),
"ChatGPT account ID not available, please re-run codex login"
);
let store = ConnectorMetadataStore::new(
config.chatgpt_base_url.clone(),
auth.get_account_id(),
auth.get_chatgpt_user_id(),
auth.is_workspace_account(),
);
let mut metadata_by_id = store.fresh_records(app_ids, include_tools);
let missing_ids = app_ids
.iter()
.filter(|app_id| !metadata_by_id.contains_key(app_id.as_str()))View on GitHub (pinned to 339751715c)