{"record":{"id":"7ae31e9d8b15c3c6","repo":"screenpipe/screenpipe","slug":"install-codex-before-connecting-chatgpt","errorCode":null,"errorMessage":"install Codex before connecting ChatGPT","messagePattern":"install Codex before connecting ChatGPT","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/screenpipe-core/src/agents/cloud.rs","lineNumber":352,"sourceCode":"                provider: \"cursor\",\n                available: true,\n                configured: cursor_configured,\n                detail: if cursor_configured {\n                    \"connected to your Cursor Cloud Agents\".into()\n                } else {\n                    \"add a Cursor API key once\".into()\n                },\n            },\n        ]\n    }\n\n    /// Starts the provider's first-party account flow. Credentials remain in\n    /// the provider CLI; screenpipe only checks whether cloud use is ready.\n    pub async fn connect_provider(&self, provider: CloudAgentProvider) -> Result<()> {\n        match provider {\n            CloudAgentProvider::Codex => {\n                let path = Self::provider_binary(provider)\n                    .ok_or_else(|| anyhow!(\"install Codex before connecting ChatGPT\"))?;\n                let output = Self::run_cli(&path, vec![\"login\".into()], None).await?;\n                if !output.success {\n                    return Err(anyhow!(\"Codex could not complete the ChatGPT sign-in\"));\n                }\n                let (_, chatgpt) = Self::codex_auth_status(&path).await;\n                if !chatgpt {\n                    return Err(anyhow!(\n                        \"Codex Cloud requires ChatGPT sign-in; choose ChatGPT in the Codex login flow\"\n                    ));\n                }\n            }\n            CloudAgentProvider::Claude => {\n                let path = Self::provider_binary(provider)\n                    .ok_or_else(|| anyhow!(\"install Claude Code before connecting Claude\"))?;\n                if !Self::claude_supports_cloud(&path).await {\n                    let output = Self::run_cli(&path, vec![\"update\".into()], None).await?;\n                    if !output.success || !Self::claude_supports_cloud(&path).await {\n                        return Err(anyhow!(","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/screenpipe/screenpipe/blob/4ebf712990fee17eeaf904dacf749b6e96ac9bf3/crates/screenpipe-core/src/agents/cloud.rs#L334-L370","documentation":"`connect_provider` starts the provider CLI's first-party login flow. For Codex it first resolves the `codex` binary via `provider_binary`; if the binary is not found on PATH (or the configured location), it throws this error because the ChatGPT sign-in cannot be performed without the Codex CLI installed. Credentials stay in the Codex CLI; screenpipe only checks readiness.","triggerScenarios":"Calling `connect_provider(CloudAgentProvider::Codex)` on a machine where the `codex` executable is not installed or not on PATH.","commonSituations":"Fresh machine setup before installing Codex; codex installed via a version manager whose PATH is not inherited by the screenpipe process (GUI launch); binary renamed or removed after an upgrade.","solutions":["Install Codex (e.g. `npm install -g @openai/codex`) and verify with `which codex`","If codex is installed but screenpipe can't find it, launch screenpipe from a shell that has your PATH set, or symlink the binary into a standard PATH dir like /usr/local/bin","Retry `connect_provider` after installation"],"exampleFix":"// before (binary missing)\n$ which codex  // not found\n// after\n$ npm install -g @openai/codex\n$ which codex  // /usr/local/bin/codex","handlingStrategy":"validation","validationCode":"use std::process::Command;\nfn codex_installed() -> bool {\n    Command::new(\"codex\").arg(\"--version\").output().map(|o| o.status.success()).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match manager.connect_provider(CloudAgentProvider::Codex).await {\n    Err(e) if e.to_string().contains(\"install Codex\") => {\n        eprintln!(\"install with: npm install -g @openai/codex\");\n    }\n    r => r?,\n}","preventionTips":["Install the Codex CLI before enabling the ChatGPT/Codex provider","Launch screenpipe from a shell whose PATH includes version-manager bin dirs, or symlink into /usr/local/bin","Surface provider_binary availability in the UI before showing the connect button"],"tags":["missing-binary","path","codex","cli-dependency"],"backgroundTag":"command-not-found","analyzedSha":"4ebf712990fee17eeaf904dacf749b6e96ac9bf3","analyzedAt":"2026-09-01T23:33:43.065Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}