Azure Responses API: Bad Request when Codex sends tool output (shell_tool). function_call_output expects string, Codex appears to send object
Resolved 💬 4 comments Opened Mar 14, 2026 by doctor-sukha Closed Mar 16, 2026
What version of the IDE extension are you using?
v26.311.21342
What subscription do you have?
Azure OpenAI / no OpenAI ChatGPT plan
Which IDE are you using?
VS Code
What platform is your computer?
Darwin 25.3.0 arm64 arm
What issue are you seeing?
- When using Codex v0.114.0 or the VS Code Codex extension with Azure OpenAI (Responses API), normal chat works but any tool execution (shell_tool / exec_command) results in “Bad Request”. However, downgrading the VS Code Codex extension to v0.4.69 makes the issue disappear.
- Futhermore, disabling shell tools avoids the error. Azure accepts tool calls and tool outputs when the output is a string, but returns 400 if the output is an object.
What steps can reproduce the bug?
codex exec "List files in this repo."- Observe "Bad Request" after tool call attempt.
What is the expected behavior?
Tool call succeeds, and model returns output.
Additional information
Environment
- Codex version: 0.114.0
- VS Code Codex extension: 0.4.69 fixes it; newer versions (v26.311.21342) reproduce the issue
- OS: macOS
- Provider: Azure OpenAI (Responses API)
- Model/deployment: gpt-5.2-codex
- base_url: https://<resource_name>.cognitiveservices.azure.com/openai/v1
- wire_api: responses
- model_reasoning_effort: medium
Additional Evidence (Azure curl test)
Azure accepts function_call_output when output is string:
POST /responses
{
"model": "gpt-5.2-codex",
"previous_response_id": "<RESP_ID>",
"input": [{
"type": "function_call_output",
"call_id": "<CALL_ID>",
"output": "{"files":["a.txt","b.txt"]}"
}]
}
=> 200 OK
Azure rejects output object:
POST /responses
{
"model": "gpt-5.2-codex",
"previous_response_id": "<RESP_ID>",
"input": [{
"type": "function_call_output",
"call_id": "<CALL_ID>",
"output": { "stdout": "a\nb\n", "stderr": "", "exit_code": 0 }
}]
}
=> 400 invalid_request_error: Invalid type for input[0].output (expected string or array of objects)
Azure also rejects type "tool_output":
=> 400 invalid_request_error: Invalid value 'tool_output' (supported includes function_call_output)
Logs (Codex)
In codex-tui.log:
- Tool call logged:
ToolCall: exec_command {"cmd":"ls"} - Immediately after:
Turn error: Bad Request
Hypothesis
Codex may be sending tool output in a structured object format that Azure Responses API rejects (expects a string or array of objects). This causes 400 on tool output submission.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗