codex - 💡(How to fix) Fix codex-responses-api-proxy fails with "API key is too large to fit in the 1024-byte buffer" when using Azure AD access tokens [3 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17099Fetched 2026-04-09 08:02:29
View on GitHub
Comments
3
Participants
1
Timeline
18
Reactions
1
Author
Participants
Timeline (top)
subscribed ×5labeled ×4mentioned ×4commented ×3

Error Message

Error: API key is too large to fit in the 1024-byte buffer Error: API key is too large to fit in the 1024-byte buffer

RAW_BUFFERClick to expand / collapse

What issue are you seeing?

The proxy should accept API keys / bearer tokens longer than 1024 bytes. Calling the Azure OpenAI Responses API directly with the same token via curl works correctly, confirming the token itself is valid.

What steps can reproduce the bug?

  1. Obtain an Azure AD access token:

    az account get-access-token
    --resource https://cognitiveservices.azure.com
    --query accessToken -o tsv

  2. Confirm the token size exceeds 1024 bytes:

    az account get-access-token
    --resource https://cognitiveservices.azure.com
    --query accessToken -o tsv | wc -c # outputs ~1400–1800

  3. Use the token as openai-api-key in codex-action with responses-api-endpoint set to an Azure OpenAI endpoint.

  4. The action fails at the "Start Responses API proxy" step with: Error: API key is too large to fit in the 1024-byte buffer

What is the expected behavior?

When using an Azure AD access token (obtained via az account get-access-token --resource https://cognitiveservices.azure.com --query accessToken -o tsv) as the openai-api-key input, codex-responses-api-proxy fails immediately with:

Error: API key is too large to fit in the 1024-byte buffer

Azure AD JWT access tokens are typically 1200–1800 bytes, which exceeds the proxy's fixed 1024-byte stdin read buffer. This causes the action to time out and report "responses-api-proxy did not write server info".

Additional information

No response

extent analysis

TL;DR

Increase the buffer size of the proxy to accommodate Azure AD access tokens larger than 1024 bytes.

Guidance

  • Verify the current buffer size limit in the proxy configuration to confirm it's the cause of the issue.
  • Consider increasing the buffer size to at least 2048 bytes to accommodate typical Azure AD JWT access token sizes.
  • Test the updated proxy configuration with a token size near the new limit to ensure it works as expected.
  • If modifying the proxy configuration is not feasible, explore alternative authentication methods that use smaller tokens.

Example

No code example is provided as the issue does not specify the programming language or framework used in the proxy implementation.

Notes

The solution assumes that the proxy buffer size can be modified. If this is not possible, alternative solutions such as token compression or using a different authentication method may be necessary.

Recommendation

Apply a workaround by increasing the proxy buffer size, as upgrading to a fixed version is not mentioned in the issue. This is because the issue seems to be related to a specific configuration limit rather than a version-specific bug.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING