bug: fails with invalid_function_parameters due to missing workdir in shell function schema

Resolved 💬 5 comments Opened Apr 22, 2025 by nectario Closed Apr 22, 2025

What version of Codex is running?

v0.1.2504220136

Which model were you using?

o4-mini

What platform is your computer?

WSL Linux - Ubuntu

What steps can reproduce the bug?

Hi OpenAI team,

I encountered an error when using codex chat in the latest version of the Codex CLI (v0.1.2504220136). When I ask the CLI to analyze the codebase, it triggers the following API error:

⚠️  OpenAI rejected the request (request ID: req_xxxxxxx). Error details: 
Status: 400,
Code: invalid_function_parameters,
Type: invalid_request_error,
Message: 400 Invalid schema for function 'shell': 
In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'workdir'...

Despite launching Codex with --workdir ., and even having workdir: . in my .codex file, the CLI still fails with this error, suggesting that the shell function's schema is malformed or incomplete — specifically missing a required array that includes workdir.

I confirmed this issue in WSL (Ubuntu) and with everything up-to-date (node v20.19.0, npm 10.7.0). I also verified that the Codex CLI is installed correctly and pointing to the right version inside WSL.

Let me know if you'd like me to help reproduce this or share logs. Thanks for all the work you're doing — this tool is incredibly promising!

Best,
Nektarios Kalogridis

What is the expected behavior?

When running codex with a valid --workdir flag or a properly configured .codex file, the CLI should successfully invoke internal tools (like shell) without throwing schema validation errors. Specifically, the shell function should receive the workdir parameter as required by the OpenAI function call schema and execute or simulate actions (e.g. listing files, analyzing structure) as intended.

What do you see instead?

⚠️ OpenAI rejected the request (request ID: req_xxxxxxx). Error details:
Status: 400,
Code: invalid_function_parameters,
Type: invalid_request_error,
Message: 400 Invalid schema for function 'shell':
In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'workdir'...

Additional information

_No response_

View original on GitHub ↗

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