codex cli non interactive mode output very large text file, 500mb to 1.8gb

Resolved 💬 5 comments Opened Jan 10, 2026 by mlion8 Closed Jan 11, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.80.0

What subscription do you have?

chatgpt plus

Which model were you using?

gpt-5.1-codex-max high and gpt-5.2-codex-max high both have this issue

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

What issue are you seeing?

<img width="2497" height="1089" alt="Image" src="https://github.com/user-attachments/assets/6b1f8c24-706f-473c-abb1-ee1920089e19" />

As the title and the image suggests,
I was using codex cli non interactive mode mostly and use codex exec "$prompt" --json 2>&1 command to output the result to a local file.
Everything was normal yesterday, but then it starts to output this very large text file and stuck there (I assume the file was too big).
It does not happen every time I run, and happens to both gpt-5.1-codex-max high and gpt-5.2-codex high model.
I downgraded to my previous codex cli version such as 0.78.0 also tried gpt-5.1-codex-max high as well, but the issue happens still from time to time.
If anyone can take a look, that will be very appreciated.

What steps can reproduce the bug?

I just let codex to review the code I write, and provide audit report in a markdown format using table.

What is the expected behavior?

It should just be a normal text file like around 20kb

Additional information

_No response_

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 7 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #7395
  • #7447
  • #8402

Powered by Codex Action

mlion8 · 7 months ago

After further digging, the issue seems to be codex now dump too much info into the json output, for anyone having the same issue, use stream to read, like tee pipeline, I am testing this approach and will report back as I go.

etraut-openai contributor · 7 months ago

Sounds like Codex CLI is working as intended here.

mlion8 · 7 months ago
Sounds like Codex CLI is working as intended here.

@etraut-openai

Thanks for the message.
Could you explain a bit further please?
So did you mean it is by design to dump 1gb of logs when using --json flag?
I have been using --json every day and it was not this case until yesterday, normally the output size is just in kb not in gb.
What should the recommended way to handle this please?
I am trying to get the agent_message.text field while also trying to preserve the thread_id so I can reuse the same context in the next run.
Thanks again.

etraut-openai contributor · 7 months ago

For details about non-interactive mode and how it works, refer to this documentation.