codex icon indicating copy to clipboard operation
codex copied to clipboard

OpenAI rejected the request

Open CALMCRAZY opened this issue 1 year ago • 10 comments

What version of Codex is running?

v0.1.2504251709

Which model were you using?

Qwen/Qwen3-235B-A22B

What platform is your computer?

Microsoft Windows NT 10.0.26100.0 x64 WSL2 ubuntu

What steps can reproduce the bug?

codex --provider one -m Qwen/Qwen3-235B-A22B --approvalMode full-auto

I'm using a local LLM service called one-api. When I make a simple request for a function, "codex" always thinks for a while and looks through a lot of code before giving this error.

Image

What is the expected behavior?

implement the function correctly

What do you see instead?

system ⚠️ OpenAI rejected the request. Error details: Status: 400, Code: invalid_type, Type: invalid_request_error, Message: 400 Invalid type for 'messages.[0].content': expected one of a string or array of objects, but got an object instead. (request id: 2025042922302269393158109822363). Please verify your settings and try again.

Additional information

No response

CALMCRAZY avatar Apr 29 '25 14:04 CALMCRAZY

me too

qcname avatar Apr 30 '25 05:04 qcname

me too OpenAI rejected the request. Error details: Status: 404, Code: unknown, Type: unknown, Message: 404 status code (no body). Please verify your settings and try again.

skywalk163 avatar Apr 30 '25 23:04 skywalk163

@skywalk163 404 is prob a wrong base url.

natikgadzhi avatar May 01 '25 05:05 natikgadzhi

Folks, it would be useful to be able to see a trace of the HTTP request that codex made when it gets a model error like this. I'm trying to debug another provider where some models work fine and others crap out with HTTP 400 with no body, and I'd love it if --debug=true would render the raw requests + headers and responses.

Would it be useful if I pushed up a PR?

natikgadzhi avatar May 01 '25 05:05 natikgadzhi

Gemini 2.5 Flash is not working as well, getting this same issue as well as errors with tool calls.

xandertreat avatar May 01 '25 20:05 xandertreat

@natikgadzhi +1

JoelAlexander avatar May 02 '25 03:05 JoelAlexander

is your config file

nabz-polo avatar May 02 '25 07:05 nabz-polo

Try removing the ~/.codex/config.json, in favor of config.yaml

fabiogalera avatar May 29 '25 14:05 fabiogalera

In debug its stuck at Failed to parse JSON result and later failure.

I am using openrouter and Qwen/Qwen3-235B-A22B and asked codex to create a hello world all in python

Rishang avatar May 31 '25 16:05 Rishang

Thanks for the feedback! Please try again on the latest version of Codex CLI. If the issue persists, let us know.

codex-maintainers avatar Aug 07 '25 18:08 codex-maintainers