Repository navigation
Description
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.
Activity
github-actions commentedon Feb 18, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
gpt-5-codexnot found. Defaulting to fallback metadata; this can degrade performance and cause issues #12100Powered by Codex Action
[-]Codex exec "Invalid Responses API request" error with OpenRouter[/-][+]Codex exec/CLI "Invalid Responses API request" error with OpenRouter[/+]sahuang commentedon Feb 18, 2026
Looks like the issue also happens with Codex CLI. Is this OpenRouter issue?
etraut-openai commentedon Feb 18, 2026
Please report the problem to open router maintainers.
fix: pin Codex to 0.94.0 + wire_api=chat for multi-turn stability
fix: pin Codex to 0.94.0 + wire_api=chat for multi-turn stability (#1518
louisgv commentedon Feb 20, 2026
Hi all -- noted and investigating
jakobdylanc commentedon Feb 20, 2026
We pushed a fix for this on the OpenRouter side! Let me know if you're still having issues.
Tobiaswk commentedon Feb 23, 2026
@jakobdylanc Still seeing this error when using gemini 2.5/3 flash through OpenRouter.
jakobdylanc commentedon Feb 23, 2026
Can you share the exact error?
Tobiaswk commentedon Feb 23, 2026
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]"}}jakobdylanc commentedon Feb 24, 2026
@Tobiaswk just pushed another fix for this! Let me know if there are more issues.
WEIFENG2333 commentedon Feb 25, 2026
@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:
{ "type": "function_call_output", "call_id": "324e300f", "output": [{ "text": "...", "type": "input_text" }] }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.Tobiaswk commentedon Feb 26, 2026
@jakobdylanc It still does not work. Same error.
sysoppl commentedon Mar 2, 2026
@jakobdylanc Same error for me using openrouter today. Worked well and stopped suddenly
jakobdylanc commentedon Mar 4, 2026
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!
etraut-openai commentedon Mar 4, 2026
Thanks @jakobdylanc, much appreciated!
papirosko commentedon Apr 17, 2026
upgraded to
codex-cli 0.121.0, now i getshiX0 commentedon Apr 17, 2026
Got the same issue, downgraded to 0.120.0 it seems to work on that.