stream disconnected before completion: Transport error: network error: error decoding response body
What issue are you seeing?
During execution, the session terminated unexpectedly with the following error:
Transport error: network error: error decoding response body
The failure occurred while the model was streaming its response. The stream disconnected before completion, leaving the output truncated and the task in an incomplete state.
Behavior observed:
- Task execution began normally.
- Partial output was received.
- Streaming stopped unexpectedly.
- The operation did not complete and no final success/failure result was returned.
- Retrying the same task may succeed, indicating the issue appears related to response transport/streaming rather than the task content itself.
Error message:
Transport error: network error: error decoding response body
Prompt context:
A large repository analysis and implementation task was being executed through Codex. The exact prompt content is project-specific, but the failure appears to have occurred during response streaming rather than during code generation or repository processing.
Expected behavior:
The response stream should complete successfully and return a final task result.
Actual behavior:
The response stream disconnected and produced the transport error above, requiring the task to be restarted.
What steps can reproduce the bug?
Steps to reproduce:
- Start a Codex task with a large repository/workspace context.
- Use a long implementation or analysis prompt that causes an extended streamed response.
- Allow the task to run until Codex begins returning output.
- Observe that the stream disconnects before completion.
Observed result:
The task stops with:
Transport error: network error: error decoding response body
The response is truncated and no final completion status is returned.
Expected result:
The streamed response should finish cleanly, even for long-running repository tasks.
Minimal reproduction snippet:
Run a Codex task against a large repository with a long prompt, for example:
"Analyze the repository, inspect the relevant docs, implement the requested fix, run validation, and provide a completion report with files changed and commands run."
Expected: Codex completes and returns the final report.
Actual: The stream may terminate with:
Transport error: network error: error decoding response body
Notes:
I do not have a smaller deterministic code-only reproduction. The issue appears tied to long streamed responses over a large task context rather than a specific code snippet in the repository.
What is the expected behavior?
Expected behavior:
After a task is submitted, Codex should maintain a stable connection for the duration of the operation and stream the response until completion.
For long-running repository analysis, implementation, or validation tasks:
- The response stream should remain connected while output is being generated.
- Partial responses should continue streaming without interruption.
- The task should either complete successfully with a final result or return a clear task-level error message.
- The client should not terminate with a transport-layer decoding error while a valid response is being streamed.
- Large outputs should be handled gracefully through chunking, pagination, or other mechanisms without disconnecting the session.
Expected outcome:
The task finishes and returns a complete response, including any implementation summary, files modified, validation results, and final completion status, without displaying:
Transport error: network error: error decoding response body
Additional information
Additional observations:
- The issue has occurred multiple times during extended Codex sessions involving large repositories and long-running implementation tasks.
- The failure appears intermittent rather than deterministic; rerunning the same task may succeed.
- The error is occurring during response streaming, not during prompt submission.
- In several cases, substantial output had already been received before the disconnect occurred.
- The issue appears more likely during tasks that generate lengthy completion reports, analyze many files, or perform multi-step repository work.
- No repository-specific error was identified at the time of failure.
- The workspace itself remained intact; the primary impact was loss of the active streamed response and the need to restart or reconstruct the task state.
- Because the stream terminates unexpectedly, it can be difficult to determine whether work completed successfully on the backend before the connection was lost.
- Any diagnostic logging related to streaming response handling, response chunk decoding, connection resets, timeouts, or transport-layer interruptions around the failure time may help identify the root cause.
Error observed:
Transport error: network error: error decoding response body
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗