Skip to content

unexpected status 401 Unauthorized issue #48237

Open

Description

@zqzhang77-bit

unexpected status 401 Unauthorized: Incorrect API key provided: sk-svcac***********************************************************************************************************************************************************fvMA. You can find your API key at https://platform.openai.com/account/api-keys., url: https://chatgpt.com/backend-api/codex/responses, cf-ray: a40d95aa6bfcb8db-SEA, request id: 436e8c67-7c9a-4980-995e-ba89a1bd5957

Image

Activity

  1. added
    bug
    auth
    on Sep 25, 2026
  2. gdwnldsKSC commented on Sep 25, 2026

    @gdwnldsKSC

    Probably an outage. Just hit it myself.

  3. lifeinink commented on Sep 25, 2026

    @lifeinink

    I'm also hitting this issue. My npm release is current.

  4. nadeemkhoury commented on Sep 25, 2026

    @nadeemkhoury

    same here

  5. sagabravo commented on Sep 25, 2026

    @sagabravo

    same problem here

  6. etraut-openai commented on Sep 25, 2026

    @etraut-openai
    Contributor

    Thanks for reporting. We're aware of the problem. Investigation is underway.

  7. gdwnldsKSC commented on Sep 25, 2026

    @gdwnldsKSC
  8. marked Codex api key error #48246 as a duplicate of this issue on Sep 25, 2026
  9. marked 972e7251cb54 #48248 as a duplicate of this issue on Sep 25, 2026
  10. 131 remaining items

  11. karitet commented on Sep 25, 2026

    @karitet

    Independent reproduction on two separate macOS machines on 26 Sep 2026, shortly after 01:00 CEST.

    Observed failure

    unexpected status 401 Unauthorized: Incorrect API key provided: sk-svcac...fvMA
    url: https://chatgpt.com/backend-api/codex/responses
    request id: 355d75c9-3274-4e90-8903-cfca2bc5041f
    

    Checks on one affected macOS machine

    codex login status
    Logged in using ChatGPT
    
    codex --version
    codex-cli 0.153.4
    

    I also checked for relevant environment variables with:

    printenv | cut -d= -f1 | grep -E '^(OPENAI|CODEX)'

    No OPENAI_* or CODEX_* variables were returned.

    The same 401 / sk-svcac... failure occurs independently on a second macOS machine, which makes a machine-specific configuration issue less likely.

    OpenAI's status page currently confirms an Issues with Codex outage affecting Codex services:
    https://status.openai.com/incidents/01M3DCNWMW57HYK8FJ5FBFPA39

    No full credential, OAuth token, hostname, internal machine name, account ID, or local path is included here.

  12. SweetLuvianto commented on Sep 25, 2026

    @SweetLuvianto

    Confirmed recovered from Jakarta (cf-ray -CGK) at 23:54 UTC — codex exec succeeded in 15 s (npm 0.157.0, ChatGPT Pro auth). Before mitigation the same command failed with the identical sk-svcac…fvMA 401 across desktop 0.158.0-alpha.2 and npm 0.157.0, models gpt-6-astra and gpt-5.5, clean env; codex doctor showed stored API key false / ChatGPT tokens true and the client log showed auth_recovery_outcome="recovery_succeeded" followed by the 401, so the rejection was upstream. Request IDs: 7d965c23-a9f4-48f9-89ad-07aa2523c1e7, cf4a35d6-6afb-46ed-978b-72411ae6ff1d, b8127fdb-0599-472d-b95e-eed33b8fcdb3.

  13. ul0gic commented on Sep 26, 2026

    @ul0gic

    Deep dive from an instrumented client: where the key actually lives, what the websocket path does, and a client-side refresh storm nobody has mentioned yet

    I pulled this apart from a Linux client (codex-cli 0.157.0, ChatGPT login, Pro plan) using Codex's own logs_*.sqlite telemetry, the session rollouts, a memory scan of the live processes, and direct HTTP + websocket probes against chatgpt.com/backend-api/codex/responses. Everything below is reproducible; the probe scripts are at the bottom.

    TL;DR

    • Client refresh storm (new, actionable, filed separately as ChatGPT auth: every retry attempt runs a full reload+refresh auth recovery, so one failed turn triggers 6 oauth/token refreshes and 18 /responses calls #48303). Because the backend forwarded a 401 instead of a 5xx, every failed turn on this client produced 18 /responses requests and 6 successful auth.openai.com/oauth/token refreshes, each rotating the refresh token. One user typing "hello" three times = 36 token refreshes in 6.5 minutes, none of which could ever succeed because the failing credential was never the user's. I found this while counting requests to work out where the key lived. Details and the exact code path in section 4.
    • Websocket path hides the failure completely (new). Same request over websocket: the server sends codex.rate_limits with allowed: true, then codex.response.metadata with freshly minted turn state, then a bare close 1011 with no error event. The client cannot tell it from a network blip, so everyone saw "Reconnecting 1/5 … 5/5" before the HTTP fallback finally showed the real error. Section 3.
    • The status code choice is what armed the client. The 401 body is the platform API's error object forwarded verbatim (code: invalid_api_key, "find your API key at platform.openai.com", nonsense for a ChatGPT-auth user). The client treats 401 as "refresh and retry". Mapping an upstream auth failure to 502/503 with a sanitized body would have prevented the storm and would stop leaking the internal key's prefix, last 4 chars and exact length to every user. Section 5.
    • Where the key lives, for the record. The sk-svcacct…fvMA key is OpenAI's own service-to-service credential inside the Codex backend. It never exists on the client (memory scan of all four live processes: masked copies only). Same 167-char key, same suffix, reported simultaneously from ORD, SJC, SEA, LAX, FRA, MAD. The 401 response itself carries x-codex-plan-type, usage headers and a fresh x-codex-turn-state, so the user's JWT was accepted before the upstream call failed. Section 1.

    1. Who holds the key

    Kept short since the root cause is already known on your side. It is here because section 4 depends on it.

    Client telemetry on every failing /responses call:

    endpoint="/responses" auth_header_attached=true auth_header_name="authorization"
    auth_mode="Chatgpt" auth_env_openai_api_key_present=false auth_env_codex_api_key_present=false
    

    No sk- key exists on this machine: not in auth.json (OPENAI_API_KEY: null), env, config, dotfiles, or the environment of the running codex processes. A memory scan of all four live Codex processes (app-server daemon, pid loop, code-mode host, TUI) found 129 copies of the masked string sk-svcac***…fvMA (71 in the daemon, 58 in the TUI: parsed 401 bodies sitting on the heap) and zero unmasked copies. The only other hit is the static sk-svcacct- prefix table in the binary's rodata (codex-rs/network-proxy/src/credential_broker/providers/openai.rs), which is a classifier, not a key.

    Direct probe with my own ChatGPT token (curl, same headers Codex sends) returns:

    HTTP/2 401
    x-codex-plan-type: pro
    x-codex-primary-used-percent: <unchanged before/after outage>
    x-codex-turn-state: gAAAAAB…   (Fernet; embedded timestamp == response Date header)
    x-oai-request-id: 39c52de5-22c2-4371-abbc-e35d0d9a14ac
    x-openai-proxy-wasm: v0.1
    cf-ray: a40dc7276a631aeb-ORD
    
    {"error":{"message":"Incorrect API key provided: sk-svcac***…fvMA. You can find your API key at https://platform.openai.com/account/api-keys.","type":"invalid_request_error","param":null,"code":"invalid_api_key"}}
    

    Those x-codex-* headers can only be populated after the backend has authenticated my JWT and looked up my account. So the order inside that single 401 is: user auth OK → plan/quota resolved → turn state minted → backend's upstream call rejected → upstream error body forwarded with the upstream status code. The client's bearer is a JWT and the error names an sk- key; the client can tell those apart, which is what the fix in section 4 relies on.

    Side note: the weekly-usage percentage did not move across ~150 failed requests on this client, so failed turns were not charged.

    2. Timeline from this client (UTC)

    • 22:46:09 last successful /responses (ChatGPT auth), mid-turn
    • 22:46:13.078 first 401, cf-ray a40d905a5cae071e-ORD, request id c56787f3-9403-4b24-937d-24ef88df9bf1
    • 22:46:32 websocket retries exhausted → "falling back to HTTP" (same 401 there)
    • 22:52:47 last 401 before I stopped typing
    • 23:23:40 and 23:31:07 direct probes: still 401
    • 23:35:44 websocket probe: still failing (details below)
    • status.openai.com incident 01M3DCNWMW57HYK8FJ5FBFPA39: opened 22:58 (Identified, "internal issue"), 23:19 "Login via API key will unblock access", 23:34 "root cause identified, moving towards mitigation", 23:45 "mitigation applied, monitoring recovery"
    • 23:37:55–23:38:38 one more turn from this client, still before mitigation: 401 again, with 2 more oauth/token refreshes inside 40 s (section 4)
    • 23:51:50 etraut-openai in this thread: "mitigated, recovery rolling out through clusters"
    • 23:57:51 this client recovered: a codex exec turn completed normally, the first successful /responses since 22:46:09. Status page shows Resolved.

    The first public report's ray (a40d8b07…-SJC) predates my first failure by roughly 3–4 minutes by ray-ID arithmetic, so onset was global around 22:42–22:46Z.

    3. What the websocket path actually does

    @bmruszaj noted above (23:20Z) that the websocket transport masks the 401 and only the HTTPS fallback exposes it. Here is what the server actually sends before it closes. Raw websocket session with the same token, sending a normal response.create:

    handshake: 101
    msg 1: {"type":"codex.rate_limits","plan_type":"pro","rate_limits":{"allowed":true,"limit_reached":false, …}}
    msg 2: {"type":"codex.response.metadata","headers":{"x-models-etag":…,"x-codex-turn-state":"gAAAAAB…"}}
    closed after 2 messages: code=1011 reason=''
    

    So over websocket the backend explicitly says allowed: true, hands out turn state, and then closes with a bare 1011 and no error event. The client maps Message::Close to ApiError::Stream("websocket closed by server before response.completed") (codex-rs/codex-api/src/endpoint/responses_websocket.rs), which is classified as retryable. That is why everyone sees "Reconnecting 2/5 … 5/5" before the HTTP fallback finally shows the real error. HTTP over-shares (leaks the upstream body); websocket under-shares (no error at all). Both hide the actual condition, which is "backend's upstream credential is invalid".

    4. The refresh storm (found while tracking this down; filed separately as #48303)

    This is not the outage. It is what the client did in response to the outage, and I only noticed because I was counting requests to work out where the key lived. It has its own issue (#48303) so it survives this one being closed; the short version is here because the numbers are from the same logs.

    Per failed user turn on this client, from logs_*.sqlite:

    Turn HTTP /responses → 401 websocket connects oauth/token refreshes (all 200)
    turn in flight at onset 18 6 6
    "ok what happened" 18 0 6
    "uhh hello" 18 0 6
    "…" 18 0 6
    each of 2 subagent turns 18 1–3 6

    36 successful token refreshes between 22:46:13 and 22:52:45 from one idle user, every one followed by another 401 (auth_recovery_followup_success="false" auth_recovery_followup_status="401" × 36). auth.json was rewritten at 22:52:45 with a rotated refresh token.

    Why exactly 18 and 6:

    1. codex-rs/core/src/responses_retry.rs: on error, retry up to max_retries (5) with backoff, then try_switch_fallback_transport, reset retries to 0, and retry 5 more times on HTTP. 6 attempts per transport.
    2. codex-rs/core/src/client.rs stream_responses_api / stream_responses_websocket: each attempt constructs a fresh auth_manager.unauthorized_recovery(). On a 401 that passes provider.is_recoverable_auth_error, handle_unauthorized walks the managed state machine Reload → RefreshToken → Done (codex-rs/login/src/auth/manager.rs), retrying the request after each step. That is 3 HTTP requests and 1 real token refresh per attempt.
    3. Once recovery is exhausted, the original UnexpectedStatus(401) escapes, and codex-rs/protocol/src/error.rs retry_delay() lists UnexpectedStatus(_) as retryable → next attempt → fresh recovery → another refresh.

    6 attempts × (1 + reload-retry + refresh-retry) = 18 requests, 6 refreshes, per turn, per client. Across the whole install base during a backend outage, that is a self-inflicted load spike on auth.openai.com plus a refresh-token rotation on every affected account, with zero chance of success because the failing credential was never the user's.

    5. Suggested fixes

    Backend:

    • Map an upstream invalid_api_key (or any upstream 401/403) to 502/503 with a sanitized body. Never forward the upstream error text: it leaks the internal key's prefix, last 4 chars and exact length, and points ChatGPT users at the API-platform key page.
    • Over websocket, emit an error event (the client already parses type: "error" frames) before closing, instead of a bare 1011.

    Client:

    • Treat a 401 whose body has code: invalid_api_key while auth_mode=Chatgpt as non-recoverable: the user's bearer is a JWT, so that error cannot be about their credential.
    • Hold one UnauthorizedRecovery per turn (or per client session) rather than per attempt, so a token refresh runs at most once per turn.
    • After recovery is exhausted, make the 401 terminal (RetryLimit/fatal) rather than a backoff-retryable UnexpectedStatus.
    • Consider treating websocket close 1011 with no prior error event as "switch to HTTP now" rather than 5 reconnects.

    Repro (websocket probe)

    # pip install websockets ; token/account_id from ~/.codex/auth.json
    import asyncio, json, sys, websockets
    tok, acc = sys.argv[1], sys.argv[2]
    body = {"type":"response.create","model":"gpt-6-astra","instructions":"Reply OK.",
            "input":[{"type":"message","role":"user","content":[{"type":"input_text","text":"Reply OK"}]}],
            "stream":True,"store":False}
    hdrs = {"Authorization":f"Bearer {tok}","chatgpt-account-id":acc,"originator":"codex_cli_rs","User-Agent":"codex_cli_rs/0.157.0"}
    async def main():
        async with websockets.connect("wss://chatgpt.com/backend-api/codex/responses", additional_headers=hdrs) as ws:
            await ws.send(json.dumps(body))
            try:
                while True: print(await ws.recv())
            except websockets.exceptions.ConnectionClosed as e:
                print("closed:", e.rcvd.code if e.rcvd else None, repr(e.rcvd.reason if e.rcvd else None))
    asyncio.run(main())

    Environment: codex-cli 0.157.0, Debian (Linux 6.12), ChatGPT login (Pro), no API key configured anywhere, [agents] enabled = true.

  14. tennysonmilesperhour commented on Sep 26, 2026

    @tennysonmilesperhour

    Same issue here, same key suffix (sk-svcac…fvMA).

    Error: unexpected status 401 Unauthorized: Incorrect API key provided: sk-svcac…fvMA
    URL: https://chatgpt.com/backend-api/codex/responses
    Started: 2026-09-25 22:41:30 UTC, every request since

    • Plan: ChatGPT Pro Lite, signed in with ChatGPT (no API key, no OPENAI/CODEX env vars, no custom provider)
    • Clients: Codex desktop 26.924.20706 (bundled codex-cli 0.158.0-alpha.2) on macOS, and Codex web. Both fail.
    • All models fail: gpt-6-astra, gpt-6-luna, codex-auto-review
    • /backend-api/codex/models returns 200 with the same token. Only /responses fails (websocket closed by server, then HTTP fallback returns 401).
    • Fresh tokens show plan_type prolite. Response headers show plan-type prolite, 62% of the weekly limit used.
    • Tried: ChatGPT logout/login, codex logout + device-auth login, reboot, switching models. No change.

    Request IDs:
    43688cb1-926e-4366-aff9-5230664ed9a3 (first failure)
    6a440474-4518-4ffd-a93b-150fc02a2390
    d87a66cd-66ef-4953-84cb-a75c83073207

  15. Jadabo3 commented on Sep 26, 2026

    @Jadabo3

    same issue...
    Title:
    Codex Desktop returns 401 Unauthorized / Incorrect API key after ChatGPT desktop update

    Summary:
    Codex in the ChatGPT Windows desktop application stopped working immediately after I used "Check for Updates" and installed the available ChatGPT desktop update.

    Prior to the update, Codex was working normally.

    After the update, every Codex request fails with:

    unexpected status 401 Unauthorized: Incorrect API key provided: sk-svcac********...

    The failing request is being sent to:

    https://chatgpt.com/backend-api/codex/responses

    Codex then repeatedly attempts to reconnect (for example, "Reconnecting 1/5" through "Reconnecting 5/5") and ultimately remains unusable.

    Environment:

    • Operating System: Windows
    • Client: ChatGPT Desktop for Windows
    • Feature: Codex
    • Codex CLI: Not installed / not available in PATH
    • Authentication method: Normal ChatGPT account sign-in
    • Issue began immediately after installing a ChatGPT desktop application update
    • ChatGPT desktop app version: [ADD VERSION IF AVAILABLE]

    Steps to Reproduce:

    1. Open the ChatGPT Windows desktop application.
    2. Use "Check for Updates."
    3. Install the available update.
    4. Reopen/use Codex.
    5. Open an existing Codex conversation or start a Codex request.
    6. Submit a prompt.

    Actual Result:
    Codex fails to process the request and displays:

    unexpected status 401 Unauthorized: Incorrect API key provided: sk-svcac********...

    You can find your API key at https://platform.openai.com/account/api-keys

    url: https://chatgpt.com/backend-api/codex/responses

    Codex then attempts to reconnect several times and continues returning the same 401 error.

    Expected Result:
    Codex should authenticate using the existing ChatGPT account/session and process the request normally, as it did prior to the desktop application update.

    Frequency:
    100% reproducible since the desktop update.

    The issue occurs with both existing Codex conversations and subsequent attempts to send new messages.

    Impact:
    Codex Desktop is completely unusable. No Codex requests can be completed because every request fails authentication.

    Troubleshooting Already Performed:

    1. Completely signed out of the ChatGPT desktop application.

    2. Closed and reopened the application.

    3. Signed back into the same ChatGPT account.

    4. Retested Codex.
      Result: Same 401 Unauthorized error.

    5. Performed a Windows application reset:
      Windows Settings > Apps > Installed apps > ChatGPT > Advanced options > Reset

    6. Relaunched ChatGPT.

    7. Signed back into the account.

    8. Retested Codex.
      Result: Same 401 Unauthorized error.

    I also tested whether the standalone Codex CLI was involved by running:

    codex login status

    PowerShell returned:

    codex: The term 'codex' is not recognized as a name of a cmdlet, function, script file, or executable program.

    This confirms I am not using a locally installed Codex CLI for these requests. The failure is occurring within the ChatGPT Windows desktop application's Codex functionality.

    Important Observation:
    I did not manually configure or change an OpenAI API key before this problem occurred.

    The 401 error references an "sk-svcac..." credential and directs me to the OpenAI API key page, despite my using Codex through the authenticated ChatGPT desktop application rather than manually configuring an API key.

    The problem began immediately after updating the ChatGPT desktop application.

    Example Error Details:
    HTTP status:
    401 Unauthorized

    Endpoint:
    https://chatgpt.com/backend-api/codex/responses

    Error:
    Incorrect API key provided: sk-svcac********...

    Latest captured request information:
    cf-ray: a40ddc015fb48f74-SJC
    request id: 4c43b244-ba96-45b4-b320-f1ceb73010a1

    An earlier occurrence also produced:
    cf-ray: a40dc485ce407803-SJC
    request id: 1442f75c-4b93-48d1-b37f-f9d34657c308

    Additional Notes:

    • The failure persists across application restarts.
    • Signing out and signing back in does not refresh/fix the credential being used by Codex.
    • Resetting the Windows application does not fix the credential.
    • The error continues to reference the same type of sk-svcac credential.
    • Normal ChatGPT functionality remains accessible; the failure is specifically occurring when Codex attempts to call /backend-api/codex/responses.
    • Because the issue began immediately following the desktop application update, this appears potentially related to authentication/session handling in the updated Windows desktop client.

    Screenshots are available showing:

    • 401 Unauthorized
    • Incorrect API key provided
    • /backend-api/codex/responses
    • Reconnecting attempts
    • cf-ray values
    • request IDs
  16. matheusfmlinhares commented on Sep 26, 2026

    @matheusfmlinhares

    I can reproduce this issue on Linux/WSL with Codex CLI 0.157.0.

    Additional A/B evidence that may help isolate the regression:

    • Authentication: Sign in with ChatGPT
    • codex login status -> Logged in using ChatGPT
    • OPENAI_API_KEY -> unset
    • CODEX_API_KEY -> unset
    • OPENAI_ACCESS_TOKEN -> unset
    • codex doctor --json -> overallStatus: ok
    • auth.credentials -> ok
    • stored API key -> false
    • stored ChatGPT tokens -> true
    • stored auth mode -> chatgpt
    • access token was freshly issued and not expired
    • debug logging showed auth_mode="Chatgpt" and recovery_exhausted
    • restarting the managed app-server daemon did not fix the issue

    Codex CLI 0.157.0:

    • trivial prompt fails with HTTP 401
    • backend reports an unexpected sk-svcac... credential

    Control test against the same endpoint using the ChatGPT access token from auth.json:

    • direct authenticated request -> HTTP 400
    • therefore the OAuth token itself is accepted by the backend

    Most importantly, using the already-installed Codex CLI 0.156.1 in the same environment, with the same ChatGPT authentication:

    • 0.157.0 -> HTTP 401
    • 0.156.1 -> works normally

    I did not change the current symlink or reinstall Codex for this A/B test.

    This suggests a regression or behavioral difference in 0.157.0 rather than an invalid ChatGPT OAuth token.

  17. tschachim commented on Sep 26, 2026

    @tschachim

    FIXED for me...

  18. kvillers1 commented on Sep 26, 2026

    @kvillers1

    FIXED for me...

    same

  19. Rabai94 commented on Sep 26, 2026

    @Rabai94

    Update: working again for me — Windows / ChatGPT Pro

    Following up on my earlier report: Codex is now working again in my Windows desktop environment with my ChatGPT account. The previously blocked task resumed, and the repeated 401 Unauthorized — Incorrect API key provided error is no longer preventing me from continuing.

    I have not established the root cause or which change restored access. This confirms recovery for my account/environment, not that the issue is resolved for every affected user.

    Thank you.

  20. edwardswhiskeyblues-alt commented on Sep 26, 2026

    @edwardswhiskeyblues-alt

    Additional Windows desktop corroboration with local timing and network evidence.

    Environment

    • Surface Pro 8, Windows 11
    • Codex desktop AppX package currently reports 26.924.1866.0
    • ChatGPT account sign-in; no user-supplied API key involved

    Observed across two independent long-running chats

    Three consecutive turns failed with the same 401 Unauthorized / Incorrect API key response from https://chatgpt.com/backend-api/codex/responses:

    1. 2026-09-25 23:03:15 UTC (first affected chat), after approximately 9m40s
      request id: d6a6eccf-0d81-47d5-844d-6765e1ec2cba
      cf-ray: a40db6b3cf757d81-SOF
    2. 2026-09-25 23:13:28 UTC (same chat), after approximately 9m50s
    3. 2026-09-25 23:24:13 UTC (a separate Codex chat), after approximately 9m28s
      request id: 2ac32735-6bf5-483f-8309-c165b434ddbc
      cf-ray: a40dd54dcaf65275-SOF

    The UI displayed Reconnecting before eventually surfacing the HTTP 401. Both chats later resumed normally and retained their history without changing any user API key.

    Correlation with the official outage

    • OpenAI incident opened: 22:58:48 UTC
    • Status update reporting elevated errors: 23:03:04 UTC
    • First local 401 above: 23:03:15 UTC, only 11 seconds after that update
    • Mitigation applied: 23:45:27 UTC
    • Incident resolved: 23:54:41 UTC

    Official incident: https://status.openai.com/incidents/01M3DCNWMW57HYK8FJ5FBFPA39

    Local-network exclusion

    Windows WLAN-AutoConfig, NCSI, NetworkProfile, DHCP and System logs show no Wi-Fi disconnect at 23:03, 23:13 or 23:24 UTC. The tablet had normal Wi-Fi traffic. A separate one-second Wi-Fi security re-authentication occurred at 23:31:25–23:31:26 UTC, after all three failures, so it cannot explain them.

    This corroborates a backend/service-credential outage rather than a user API-key or local-network problem. It also demonstrates the UX problem on Windows: websocket reconnect attempts look like a local connectivity failure, followed by a misleading API-key instruction for ChatGPT-authenticated users.

  21. jocoal693-cpu commented on Sep 26, 2026

    @jocoal693-cpu

    I encountered the same 401 authentication issue in the VS Code Codex extension.

    Environment:

    • Windows
    • VS Code Codex extension v26.917.62051
    • ChatGPT Plus login
    • No OPENAI_API_KEY configured

    Sequence:

    1. Codex was working normally.
    2. I reached the Codex usage limit while a coding task was still in progress.
    3. I shut down the PC.
    4. The next morning I reopened VS Code and asked Codex to continue the unfinished task.
    5. Codex returned:
      401 Unauthorized: Incorrect API key provided: sk-svcac…fvMA
    6. I did not sign out, change authentication settings, change API keys, or reinstall anything.
    7. After another full shutdown and reboot, the issue resolved itself.

    I also tried the built-in /feedback command, but it returned:
    "Couldn't verify feedback permissions. Please try again"

    I opened #48570 with the full details.

    This may help determine whether the same authentication issue also affects the VS Code IDE extension and whether usage-limit recovery/session resumption is relevant.

  22. HineshMandalia commented on Sep 28, 2026

    @HineshMandalia

    Also affected on Raspberry Pi OS 13 (aarch64), Codex CLI 0.158.0.

    codex login status reports:
    Logged in using ChatGPT

    codex doctor --json shows:

    • stored API key: false
    • stored ChatGPT tokens: true
    • stored auth mode: chatgpt
    • model provider: openai
    • ChatGPT websocket handshake succeeds

    No OPENAI_API_KEY / CODEX_API_KEY / CODEX_ACCESS_TOKEN / OPENAI_BASE_URL environment variables are set.

    Still getting:
    401 Unauthorized: Incorrect API key provided: sk-svcac...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    authbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions