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"
    }
  }
}

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗