AGENTS.md is silently ignored when invalid utf8 characters are present

Resolved 💬 3 comments Opened May 18, 2026 by runfence Closed May 20, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

0.130.0

What subscription do you have?

Pro

What platform is your computer?

Windows

What terminal emulator and version are you using (if applicable)?

Windows Terminal (PowerShell)

Codex doctor report

error: unexpected argument '--json' found

What issue are you seeing?

c:\Users\USERNAME\.codex\AGENTS.md is not injected into context after I accidentally put invalid utf8 characters into the text there.

What steps can reproduce the bug?

Edit the file with wrong encoding, add some quotes that read as ? when opened back in utf8.

Uploaded thread: 019e38be-0085-7450-9591-5828b2035e64

What is the expected behavior?

c:\Users\USERNAME\.codex\AGENTS.md is injected into context, merged with project level AGENTS.md if exists. If invalid characters prevent this from working, a clear error message should show it.

View original on GitHub ↗

3 Comments

jjoanna2-debug · 3 months ago

Happened to me too. I just told Codex to find it, make sure it doesn't do it again, tell it to run a QA, RCA, and a smoke-test and it shouldn't resurface any issues back. Try and see if that works!

runfence · 3 months ago

Updated the issue. Turns out the cause was invalid characters but no error message was shown.

etraut-openai contributor · 3 months ago

Thanks for the bug report. This will be addressed in an upcoming version.