Codex exec/CLI "Invalid Responses API request" error with OpenRouter
What issue are you seeing?
When running codex exec with OpenRouter, I am seeing a long error message after request API is run. I tried it with another third party API and there's no such issue. Below is the command, I am already using "responses" wire.
Also, "Model metadata for openai/gpt-5.2 not found. Defaulting to fallback metadata; this can degrade performance and cause issues." this error wasn't showing for my success run on another third party router.
$ codex exec -c "preferred_auth_method=apikey" -c "model=openai/gpt-5.2" -c "model_provider=openrouter" -c "model_providers.openrouter.name=openrouter" -c "model_providers.openrouter.env_key=OPENROUTER_API_KEY" -c "model_providers.openrouter.base_url=\"https://openrouter.ai/api/v1\"" -c "model_providers.openrouter.wire_api=responses" -s danger-full-access --skip-git-repo-check --cd "/home/sahuang/test_repo" -c "model_reasoning_effort=high" --json "Can you list the files in this directory?"
{"type":"thread.started","thread_id":"019c7036-fdd5-74b3-85c9-42f2cf706445"}
{"type":"item.completed","item":{"id":"item_0","type":"error","message":"Model metadata for `openai/gpt-5.2` not found. Defaulting to fallback metadata; this can degrade performance and cause issues."}}
{"type":"turn.started"}
{"type":"item.completed","item":{"id":"item_1","type":"agent_message","text":"I’ll run a quick directory listing in `/home/sahuang/test_repo`."}}
{"type":"item.completed","item":{"id":"item_2","type":"reasoning","text":"I need to list the files in the current working directory, so I'll use the exec_command to run \"ls.\" There's no need to use the web for this task. First, I should provide a brief preamble to explain what I'm doing, and then I'll call the tool. I want to make sure everything is clear and accessible for whoever needs this information. Keeping things organized is important!"}}
{"type":"item.started","item":{"id":"item_3","type":"command_execution","command":"/bin/bash -lc 'cd /home/sahuang/test_repo && ls -la'","aggregated_output":"","exit_code":null,"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_3","type":"command_execution","command":"/bin/bash -lc 'cd /home/sahuang/test_repo && ls -la'","aggregated_output":"total 28\ndrwxr-xr-x 7 sahuang sahuang 4096 Feb 12 10:50 .\ndrwxr-x--- 41 sahuang sahuang 4096 Feb 18 17:10 ..\ndrwxr-xr-x 2 sahuang sahuang 4096 Dec 3 17:53 another_folder\ndrwxr-xr-x 2 sahuang sahuang 4096 Dec 3 17:53 folder1\ndrwxr-xr-x 2 sahuang sahuang 4096 Dec 3 17:53 hello_folder\ndrwxr-xr-x 2 sahuang sahuang 4096 Feb 4 16:26 newfolder\ndrwxr-xr-x 2 sahuang sahuang 4096 Feb 12 10:58 triaged\n","exit_code":0,"status":"completed"}}
{"type":"error","message":"{\"error\":{\"code\":\"invalid_prompt\",\"message\":\"Invalid Responses API request\"},\"metadata\":{\"raw\":\"[\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected string, received array\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"message\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"message\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"user\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"user\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"system\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"system\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"assistant\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"assistant\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"developer\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"developer\\\\\\\"\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n \\\"role\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected string, received null\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"message\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"message\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"user\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"user\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"system\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"system\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"developer\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"developer\\\\\\\"\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n \\\"role\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n },\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"function_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"function_call\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"call_id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"name\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"arguments\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"function_call_output\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"function_call_output\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"call_id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"output\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"assistant\\\"\\n ],\\n \\\"path\\\": [\\n \\\"role\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"assistant\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"message\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"message\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"function_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"function_call\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"name\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"arguments\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"call_id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"web_search_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"web_search_call\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"completed\\\",\\n \\\"searching\\\",\\n \\\"in_progress\\\",\\n \\\"failed\\\"\\n ],\\n \\\"path\\\": [\\n \\\"status\\\"\\n ],\\n \\\"message\\\": \\\"Invalid option: expected one of \\\\\\\"completed\\\\\\\"|\\\\\\\"searching\\\\\\\"|\\\\\\\"in_progress\\\\\\\"|\\\\\\\"failed\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"file_search_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"file_search_call\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"queries\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received undefined\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"completed\\\",\\n \\\"searching\\\",\\n \\\"in_progress\\\",\\n \\\"failed\\\"\\n ],\\n \\\"path\\\": [\\n \\\"status\\\"\\n ],\\n \\\"message\\\": \\\"Invalid option: expected one of \\\\\\\"completed\\\\\\\"|\\\\\\\"searching\\\\\\\"|\\\\\\\"in_progress\\\\\\\"|\\\\\\\"failed\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"image_generation_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"image_generation_call\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"in_progress\\\",\\n \\\"completed\\\",\\n \\\"generating\\\",\\n \\\"failed\\\"\\n ],\\n \\\"path\\\": [\\n \\\"status\\\"\\n ],\\n \\\"message\\\": \\\"Invalid option: expected one of \\\\\\\"in_progress\\\\\\\"|\\\\\\\"completed\\\\\\\"|\\\\\\\"generating\\\\\\\"|\\\\\\\"failed\\\\\\\"\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n 6\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n \\\"input\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n }\\n]\"}}"}
{"type":"turn.failed","error":{"message":"{\"error\":{\"code\":\"invalid_prompt\",\"message\":\"Invalid Responses API request\"},\"metadata\":{\"raw\":\"[\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected string, received array\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"message\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"message\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"user\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"user\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"system\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"system\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"assistant\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"assistant\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"developer\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"developer\\\\\\\"\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n \\\"role\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected string, received null\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"message\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"message\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"user\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"user\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"system\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"system\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"developer\\\"\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"developer\\\\\\\"\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n \\\"role\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n },\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"function_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"function_call\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"call_id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"name\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"arguments\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"function_call_output\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"function_call_output\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"call_id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"output\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_union\\\",\\n \\\"errors\\\": [\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"assistant\\\"\\n ],\\n \\\"path\\\": [\\n \\\"role\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"assistant\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"message\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"message\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"content\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received null\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"function_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"function_call\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"name\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"arguments\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n },\\n {\\n \\\"expected\\\": \\\"string\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"call_id\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected string, received undefined\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"web_search_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"web_search_call\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"completed\\\",\\n \\\"searching\\\",\\n \\\"in_progress\\\",\\n \\\"failed\\\"\\n ],\\n \\\"path\\\": [\\n \\\"status\\\"\\n ],\\n \\\"message\\\": \\\"Invalid option: expected one of \\\\\\\"completed\\\\\\\"|\\\\\\\"searching\\\\\\\"|\\\\\\\"in_progress\\\\\\\"|\\\\\\\"failed\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"file_search_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"file_search_call\\\\\\\"\\\"\\n },\\n {\\n \\\"expected\\\": \\\"array\\\",\\n \\\"code\\\": \\\"invalid_type\\\",\\n \\\"path\\\": [\\n \\\"queries\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected array, received undefined\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"completed\\\",\\n \\\"searching\\\",\\n \\\"in_progress\\\",\\n \\\"failed\\\"\\n ],\\n \\\"path\\\": [\\n \\\"status\\\"\\n ],\\n \\\"message\\\": \\\"Invalid option: expected one of \\\\\\\"completed\\\\\\\"|\\\\\\\"searching\\\\\\\"|\\\\\\\"in_progress\\\\\\\"|\\\\\\\"failed\\\\\\\"\\\"\\n }\\n ],\\n [\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"image_generation_call\\\"\\n ],\\n \\\"path\\\": [\\n \\\"type\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input: expected \\\\\\\"image_generation_call\\\\\\\"\\\"\\n },\\n {\\n \\\"code\\\": \\\"invalid_value\\\",\\n \\\"values\\\": [\\n \\\"in_progress\\\",\\n \\\"completed\\\",\\n \\\"generating\\\",\\n \\\"failed\\\"\\n ],\\n \\\"path\\\": [\\n \\\"status\\\"\\n ],\\n \\\"message\\\": \\\"Invalid option: expected one of \\\\\\\"in_progress\\\\\\\"|\\\\\\\"completed\\\\\\\"|\\\\\\\"generating\\\\\\\"|\\\\\\\"failed\\\\\\\"\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [],\\n \\\"message\\\": \\\"Invalid input\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n 6\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n }\\n ]\\n ],\\n \\\"path\\\": [\\n \\\"input\\\"\\n ],\\n \\\"message\\\": \\\"Invalid input\\\"\\n }\\n]\"}}"}}
What steps can reproduce the bug?
See above command. The huge error occurs once every 2-3 runs.
What is the expected behavior?
Example of a successful run
$ codex exec -c "preferred_auth_method=apikey" -c "model=openai/gpt-5.2" -c "model_provider=openrouter" \
-c "model_providers.openrouter.name=openrouter" -c "model_providers.openrouter.env_key=OPENROUTER_API_KEY" \
-c "model_providers.openrouter.base_url=\"https://openrouter.ai/api/v1\"" \
-c "model_providers.openrouter.wire_api=responses" \
-s danger-full-access --skip-git-repo-check \
--cd "/home/sahuang/test_repo" -c "model_reasoning_effort=high" \
--json "Can you list the files in this directory?"
{"type":"thread.started","thread_id":"019c7031-521a-7b42-a411-8f8d58eee9dd"}
{"type":"item.completed","item":{"id":"item_0","type":"error","message":"Model metadata for `openai/gpt-5.2` not found. Defaulting to fallback metadata; this can degrade performance and cause issues."}}
{"type":"turn.started"}
{"type":"item.completed","item":{"id":"item_1","type":"agent_message","text":"I’ll list the files in `/home/sahuang/test_repo`."}}
{"type":"item.started","item":{"id":"item_2","type":"command_execution","command":"/bin/bash -lc 'cd /home/sahuang/test_repo && ls -la'","aggregated_output":"","exit_code":null,"status":"in_progress"}}
{"type":"item.completed","item":{"id":"item_2","type":"command_execution","command":"/bin/bash -lc 'cd /home/sahuang/test_repo && ls -la'","aggregated_output":"total 28\ndrwxr-xr-x 7 sahuang sahuang 4096 Feb 12 10:50 .\ndrwxr-x--- 41 sahuang sahuang 4096 Feb 18 17:10 ..\ndrwxr-xr-x 2 sahuang sahuang 4096 Dec 3 17:53 another_folder\ndrwxr-xr-x 2 sahuang sahuang 4096 Dec 3 17:53 folder1\ndrwxr-xr-x 2 sahuang sahuang 4096 Dec 3 17:53 hello_folder\ndrwxr-xr-x 2 sahuang sahuang 4096 Feb 4 16:26 newfolder\ndrwxr-xr-x 2 sahuang sahuang 4096 Feb 12 10:58 triaged\n","exit_code":0,"status":"completed"}}
{"type":"item.completed","item":{"id":"item_3","type":"agent_message","text":"- `another_folder/`\n- `folder1/`\n- `hello_folder/`\n- `newfolder/`\n- `triaged/`"}}
{"type":"turn.completed","usage":{"input_tokens":21189,"cached_input_tokens":20736,"output_tokens":106}}
Additional information
Tried other models like gpt-5 and gpt-5.2-codex, same issue. I am not sure if this is OpenRouter issue, since the same command with a different third-party provider has no problem. I did not put config.toml or auth.json under ~/.codex folder and run codex exec directly instead of CLI.
16 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Looks like the issue also happens with Codex CLI. Is this OpenRouter issue?
<img width="914" height="76" alt="Image" src="https://github.com/user-attachments/assets/d2385abf-9c0d-4951-a7e3-6458bd90d4f9" />
<img width="959" height="259" alt="Image" src="https://github.com/user-attachments/assets/81fd7025-5e4a-44b3-b51f-d6e16cca0cd6" />
Please report the problem to open router maintainers.
Hi all -- noted and investigating
We pushed a fix for this on the OpenRouter side! Let me know if you're still having issues.
@jakobdylanc Still seeing this error when using gemini 2.5/3 flash through OpenRouter.
Can you share the exact error?
Here you go;
{"error":{"code":"invalid_prompt","message":"Invalid Responses API request"},"metadata":{"raw":"[\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [],\n \"message\": \"Invalid input: expected string, received array\"\n }\n ],\n [\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"reasoning\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"reasoning\\\"\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"summary\"\n ],\n \"message\": \"Invalid input: expected array, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [],\n \"message\": \"Invalid input: expected array, received null\"\n }\n ],\n [\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [],\n \"message\": \"Invalid input: expected string, received null\"\n }\n ]\n ],\n \"path\": [\n \"content\"\n ],\n \"message\": \"Invalid input\"\n }\n ],\n [\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"user\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"user\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"system\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"system\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"developer\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"developer\\\"\"\n }\n ]\n ],\n \"path\": [\n \"role\"\n ],\n \"message\": \"Invalid input\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"content\"\n ],\n \"message\": \"Invalid input: expected array, received null\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"function_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"function_call\\\"\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"call_id\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"arguments\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"id\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"function_call_output\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"function_call_output\\\"\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"call_id\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"output\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"message\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"message\\\"\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"content\"\n ],\n \"message\": \"Invalid input: expected array, received null\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"reasoning\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"reasoning\\\"\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"summary\"\n ],\n \"message\": \"Invalid input: expected array, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"function_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"function_call\\\"\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"arguments\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"call_id\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"web_search_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"web_search_call\\\"\"\n },\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"completed\",\n \"searching\",\n \"in_progress\",\n \"failed\"\n ],\n \"path\": [\n \"status\"\n ],\n \"message\": \"Invalid option: expected one of \\\"completed\\\"|\\\"searching\\\"|\\\"in_progress\\\"|\\\"failed\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"file_search_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"file_search_call\\\"\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"queries\"\n ],\n \"message\": \"Invalid input: expected array, received undefined\"\n },\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"completed\",\n \"searching\",\n \"in_progress\",\n \"failed\"\n ],\n \"path\": [\n \"status\"\n ],\n \"message\": \"Invalid option: expected one of \\\"completed\\\"|\\\"searching\\\"|\\\"in_progress\\\"|\\\"failed\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"image_generation_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"image_generation_call\\\"\"\n },\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"in_progress\",\n \"completed\",\n \"generating\",\n \"failed\"\n ],\n \"path\": [\n \"status\"\n ],\n \"message\": \"Invalid option: expected one of \\\"in_progress\\\"|\\\"completed\\\"|\\\"generating\\\"|\\\"failed\\\"\"\n }\n ]\n ],\n \"path\": [],\n \"message\": \"Invalid input\"\n }\n ]\n ],\n \"path\": [\n 2\n ],\n \"message\": \"Invalid input\"\n },\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"reasoning\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"reasoning\\\"\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"content\"\n ],\n \"message\": \"Invalid input: expected array, received string\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"summary\"\n ],\n \"message\": \"Invalid input: expected array, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"user\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"user\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"system\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"system\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"assistant\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"assistant\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"developer\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"developer\\\"\"\n }\n ]\n ],\n \"path\": [\n \"role\"\n ],\n \"message\": \"Invalid input\"\n }\n ],\n [\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"user\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"user\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"system\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"system\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"developer\"\n ],\n \"path\": [],\n \"message\": \"Invalid input: expected \\\"developer\\\"\"\n }\n ]\n ],\n \"path\": [\n \"role\"\n ],\n \"message\": \"Invalid input\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"content\"\n ],\n \"message\": \"Invalid input: expected array, received string\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"function_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"function_call\\\"\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"call_id\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"arguments\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"id\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"function_call_output\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"function_call_output\\\"\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"call_id\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"output\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"assistant\"\n ],\n \"path\": [\n \"role\"\n ],\n \"message\": \"Invalid input: expected \\\"assistant\\\"\"\n },\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"message\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"message\\\"\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"content\"\n ],\n \"message\": \"Invalid input: expected array, received string\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"reasoning\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"reasoning\\\"\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"content\"\n ],\n \"message\": \"Invalid input: expected array, received string\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"summary\"\n ],\n \"message\": \"Invalid input: expected array, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"function_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"function_call\\\"\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"name\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"arguments\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n },\n {\n \"expected\": \"string\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"call_id\"\n ],\n \"message\": \"Invalid input: expected string, received undefined\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"web_search_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"web_search_call\\\"\"\n },\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"completed\",\n \"searching\",\n \"in_progress\",\n \"failed\"\n ],\n \"path\": [\n \"status\"\n ],\n \"message\": \"Invalid option: expected one of \\\"completed\\\"|\\\"searching\\\"|\\\"in_progress\\\"|\\\"failed\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"file_search_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"file_search_call\\\"\"\n },\n {\n \"expected\": \"array\",\n \"code\": \"invalid_type\",\n \"path\": [\n \"queries\"\n ],\n \"message\": \"Invalid input: expected array, received undefined\"\n },\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"completed\",\n \"searching\",\n \"in_progress\",\n \"failed\"\n ],\n \"path\": [\n \"status\"\n ],\n \"message\": \"Invalid option: expected one of \\\"completed\\\"|\\\"searching\\\"|\\\"in_progress\\\"|\\\"failed\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"image_generation_call\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input: expected \\\"image_generation_call\\\"\"\n },\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"in_progress\",\n \"completed\",\n \"generating\",\n \"failed\"\n ],\n \"path\": [\n \"status\"\n ],\n \"message\": \"Invalid option: expected one of \\\"in_progress\\\"|\\\"completed\\\"|\\\"generating\\\"|\\\"failed\\\"\"\n }\n ]\n ],\n \"path\": [],\n \"message\": \"Invalid input\"\n }\n ]\n ],\n \"path\": [\n 3\n ],\n \"message\": \"Invalid input\"\n }\n ]\n ],\n \"path\": [\n \"input\"\n ],\n \"message\": \"Invalid input\"\n }\n]"}}@Tobiaswk just pushed another fix for this! Let me know if there are more issues.
@jakobdylanc Still seeing this issue. OpenRouter's validation rejects
function_call_output.outputwhen it's an array, but OpenAI's Responses API officially supports it as a union type:Our request sends:
This is valid per OpenAI's schema, but OpenRouter rejects it with
invalid_prompt. Looks like OpenRouter's validation schema needs to be updated to accept the array format forfunction_call_output.output.@jakobdylanc It still does not work. Same error.
@jakobdylanc Same error for me using openrouter today. Worked well and stopped suddenly
Hey all, sorry for the delays here!
Just pushed some more fixes on the OpenRouter end - the specific issue @WEIFENG2333 called out should be fixed now.
Please continue to share the exact errors you are seeing and I'll keep bugfixing!
Thanks @jakobdylanc, much appreciated!
upgraded to
codex-cli 0.121.0, now i getGot the same issue, downgraded to 0.120.0 it seems to work on that.