Azure OpenAI: TypeError: Cannot use 'in' operator to search for 'tool_calls' in undefined
Resolved 💬 3 comments Opened May 22, 2025 by lazorfuzz Closed Aug 7, 2025
What version of Codex is running?
0.1.2505172129
Which model were you using?
o3
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
Using Azure OpenAI with the o3 model crashes after the first input and first response.
Consistently crashing with this error after the first input:TypeError: Cannot use 'in' operator to
search for 'tool_calls' in undefined
What is the expected behavior?
Expecting it to not throw
What do you see instead?
TypeError: Cannot use 'in' operator to search for 'tool_calls' in undefined
at $ze (file:///Users/leonli/workspace/codex/codex-cli/dist/cli.js:425:7661)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Iy.run (file:///Users/leonli/workspace/codex/codex-cli/dist/cli.js:599:2785)
Additional information
~/.codex/config.json
{
"model": "o3",
"providers": {
"azure": {
"name": "AzureOpenAI",
"baseURL": "https://myhost.openai.azure.com/openai",
"envKey": "AZURE_OPENAI_API_KEY"
}
}
}
3 Comments
Thanks a lot @lazorfuzz for the fix — it completely resolves the initial error on my end! 🎉
However, I'm encountering a potential follow-up issue that might or might not be related: some shell actions (like adding a file to the Git repo) appear to return the correct command (git add AGENTS.md) but don’t seem to actually execute it.
Oddly enough, other shell commands like git status seem to execute just fine.
Have you encountered anything like this in your own tests?
Hey, I haven't seen this. It's odd that we don't see the
function_call_outputresponse, but the function call below is virtually the same. Doesn't seem related. I tested and got an output:Thank you for the feedback! Please try running your setup with the latest version of Codex CLI. If the issue persists, we'd appreciate if you could verify it on the native/Rust implementation of Codex CLI.