Windows: Codex cannot decode MCP initialize responses #48116
On T3 Code 0.1.13 with Codex 0.169.0, a fresh Codex turn after a restart reproduced failures for both t3-code and t3-code-direct. T3 logged six successful authenticated initialize requests over localhost, all HTTP 200. Codex failed to decode the response body on every attempt and never reached tools/list. The model still returned its text reply. Can you recommend a diagnostic that compares response headers and body completion on both sides without logging credentials or message content?
tanstack-source added labelsbug
juliusmarminge added labelsneeds more info
Thanks for checking on a clean Windows machine. I ran those checks on my T3 Code 0.1.13 install, which has local UI customizations.
After relaunching T3 with the suggested
RUST_LOGsetting, botht3-codeandt3-code-directstill failed during initialization. The error I found in thermcp::transport::workerlogs waserror decoding response body. I didn’t find a more specific cause in the matching log entries.None of
HTTP_PROXY,HTTPS_PROXY,ALL_PROXY, orNO_PROXYwas set in the shell I tested, and WinHTTP reported direct access. Both unauthenticated curl runs against localhost/mcpreturned the same headers:HTTP/1.1 401 Unauthorized Content-Type: application/json Transfer-Encoding: chunkedNeither response included
Content-LengthorContent-Encoding. Both runs ended withcurl: (56) chunk hex-length char not a hex digit: 0x7b. That shows what curl received on the401; I haven’t confirmed whether the authenticated200has the same problem.Is there a way to check whether T3 emits that framing before the response reaches curl, without capturing the token or body?
juliusmarminge removed labelsneeds more info
@MrWrecks Main's own server answers your unauthenticated curl with
content-length: 90and awww-authenticate: Bearer resource_metadata=...header, and curl exits cleanly. Your response had neither header and was markedTransfer-Encoding: chunked. If you run a stock, unmodified T3 Code 0.1.13 (or the latest nightly) with your local customizations removed, does the samecurl.exe -sS -D - -o NUL -X POST http://127.0.0.1:<port>/mcp ...still showTransfer-Encoding: chunkedwithoutwww-authenticate, and does Codex then initialize?juliusmarminge added labelsneeds more info
Thanks for checking. I haven’t tried a stock build yet, but I was able to reproduce a difference without changing the T3 install. I ran the same unauthenticated localhost POST on my customized 0.1.13 build three times:
- AVG Web Shield on:
401,Transfer-Encoding: chunked, curl exit 56 (chunk hex-length char not a hex digit: 0x7b). - Web Shield paused:
401,Content-Length: 90, curl exit 0. - Web Shield back on: the original framing error returned, with curl exit 56.
In a separate Codex turn with Web Shield briefly paused, both
t3-codeandt3-code-directreachedready. The subsequent tool call stopped at an approval prompt, so I can confirm initialization but not a completed call. My header capture didn’t includeWWW-Authenticate, so I can’t say whether it was present.Web Shield is back on. I have an AVG update pending a restart and will retest after it applies.
- AVG Web Shield on:
juliusmarminge removed labelsneeds more info
Thanks for narrowing this down. Your test with Web Shield on, paused, then on again points to the cause. Unchanged, T3 Code answers that request with
Content-Length: 90, and curl exits cleanly. With AVG Web Shield on, the response arrives markedTransfer-Encoding: chunked, and the body starts with{(0x7b) where a chunk size should be. That means something between the two processes rewrote the response headers but left the body as it was. T3 still logs a 200 because its own response was fine. Codex'serror decoding response bodycomes from the rewritten framing. Since pausing Web Shield lets botht3-codeandt3-code-directreachready, AVG is causing this, not T3 or Codex.To keep Web Shield on, add an exception so it stops scanning local traffic to T3. In AVG, go to Menu → Settings → Protection → Core Shields → Web Shield, and either add
127.0.0.1andlocalhost(or the exacthttp://127.0.0.1:<port>/mcpURLs) to the URL exceptions, or add the T3 Code and Codex executables to the excluded processes. If your AVG version has the "Enable HTTPS scanning" or "scan local traffic" options, turning off local scanning also fixes it. After your AVG update applies, run the samecurl.exe -sS -D - -o NUL -X POST http://127.0.0.1:<port>/mcp ...check again. If it showsContent-Lengthand curl exits 0 with Web Shield on, Codex should initialize. If it still showsTransfer-Encoding: chunkedand exit 56, the exception has not taken effect yet.juliusmarminge added labelsneeds more info
Sign in to join this conversation.
We couldn't reproduce this. On a clean Windows machine with Codex 0.169.0 and current main, both
t3-codeandt3-code-directfinish initialize over localhost. So something between the two processes on your machine is the likely cause. These checks don't log credentials or message content:$env:RUST_LOG = "codex_rmcp_client=debug,rmcp=debug", so the Codex it launches gets that variable. Start a Codex turn. Then read the lines whose target starts withrmcporcodex_rmcp_clientfrom%USERPROFILE%\.codex\logs_2.sqlite, in thelogstable, columnfeedback_log_body. The full decode error says which part broke: content type, SSE framing, an early end of stream, or a compressed body. Remove anyBearer …value before you share a line.Get-ChildItem env: | ? Name -match 'proxy'andnetsh winhttp show proxy. IfHTTP_PROXY,HTTPS_PROXYorALL_PROXYis set andNO_PROXYdoes not includelocalhost,127.0.0.1, Codex sends localhost traffic through the proxy. The proxy can then hand back a body Codex cannot read, even though T3 still logs a 200. Also check for antivirus or endpoint software that inspects local HTTP.curl.exe -sS -D - -o NUL -X POST http://127.0.0.1:<port>/mcp -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" --data "{}". Without a token this returns 401 and needs no credentials. CompareContent-Type,Content-Encoding,Transfer-EncodingandContent-Lengthwith what Codex's debug log says it received. Run it once with the proxy variables set and once with them cleared ($env:HTTP_PROXY=$nulland so on). If the headers differ between the two runs, something in between is rewriting the response.Please reply with the rmcp error line, which proxy variables are set (names only), and the two sets of headers.