【BUG】Codex CLI hooks fail silently on Linux/Windows when editing large files

Open 💬 2 comments Opened Apr 16, 2026 by peckfly
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of the Codex App are you using (From “About Codex” dialog)?

latest (0.121.0)

What subscription do you have?

Pro

What platform is your computer?

Linux / Windows

What issue are you seeing?

On Linux and Windows, when Codex edits a large file (roughly >100KB or >1500-2000 lines), the preToolUse/postToolUse hooks fail silently and never execute.

The hook input payload includes the full file content, which exceeds OS-level argument size limits:

  • Linux: E2BIG (MAX_ARG_STRLEN = 128KB)
  • Windows: ENAMETOOLONG (command-line length limit ~32KB)

This does NOT occur on macOS.

What steps can reproduce the bug?

  1. Configure a tool hook (e.g. preToolUse / postToolUse) in hooks.json
  2. Use Codex to edit a file with >1500-2000 lines (or >100KB in size)
  3. Observe that the hook process is never spawned — no output, no error in the terminal

What is the expected behavior?

Hooks should fire regardless of file size. The hook input should be passed entirely via stdin pipe rather than command-line arguments or environment variables.

Additional information

Editing smaller files (e.g. <50KB) in the same session works correctly — hooks fire successfully. macOS is not affected by this issue.

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 4 months ago

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

  • #17794
  • #16732

Powered by Codex Action

oxysoft · 3 months ago

Indexed this hook ticket in the umbrella tracker: #21753

Goal: collect the scattered Codex hook requests and bugs into one parity matrix for Full Claude Code Hook Parity (29+), while preserving this issue as the detailed thread for its specific behavior.