Responses API: unrecognized input item type (e.g. Codex CLI's additional_tools) aborts the whole request instead of being skipped
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Read tools/server/server-chat.cpp, especially server_chat_convert_responses_to_chatcmpl and its handling of unsupported top-level tool types. Follow how unknown input items reach the final else, then check the existing Responses API tests for a suitable place to add a regression fixture with an additional_tools item. Done means that item is skipped with a warning and the rest of the request is processed successfully.
Written by the indexing model from the issue text.
Description
Summary
The Responses API → Chat Completions translation layer in tools/server/server-chat.cpp (server_chat_convert_responses_to_chatcmpl) throws and aborts the whole request when the input array contains an item type it doesn't recognize:
} else {
throw std::invalid_argument("Cannot determine type of 'item'");
}
This currently breaks every request sent by recent Codex CLI builds, regardless of the model being served, because OpenAI has server-side-enabled a newer Codex capability ("Code Mode" / unified_exec) that adds a new input item to announce an additional tool namespace:
{
"type": "additional_tools",
"role": "developer",
"tools": [
{
"type": "namespace",
"name": "functions",
"tools": [
{ "type": "custom", "name": "exec", "...": "..." }
]
}
]
}
llama-server's parser doesn't know this shape, falls into the final else, and throws, which surfaces to the Codex client as HTTP 400: Cannot determine type of 'item' — failing the request before the model ever sees it.
Notably, the top-level tools array in the same endpoint already has a lenient fallback for unsupported tool types a few lines below (SRV_WRN("unsupported Responses tool type '%s' skipped\n", ...); continue;), so there's existing precedent in this file for "skip with a warning" instead of "abort the whole request" when encountering something from a newer/evolving client that isn't critical to answering the user's actual message.
Why this matters
This isn't model-specific or configuration-specific — any user running llama-server as a Codex CLI backend via the Responses API will hit this the moment Codex (any installed version — this is gated by a server-side feature flag, not the CLI version) decides to send this item. It silently breaks previously-working setups with no local change on the user's side, which makes it hard to diagnose without inspecting the raw request body (llama-server's own verbose logging does not log raw request bodies).
Repro
- Run llama-server with
--jinjaserving any model via the Responses API (/v1/responses), as Codex CLI'swire_api = "responses"config expects. - Use a Codex CLI build where the server-side
code_mode_host/unified_execfeature flags are enabled (check withcodex features list) and run anycodex execcommand. - The request fails with
HTTP 400: Cannot determine type of 'item'.
Proposed fix
Mirror the existing lenient handling already used for unsupported top-level tools entries: treat unrecognized input item types as skippable instead of fatal.
} else {
- throw std::invalid_argument("Cannot determine type of 'item'");
+ const std::string item_type = json_value(item, "type", std::string("<missing>"));
+ SRV_WRN("unsupported Responses input item type '%s' skipped\n", item_type.c_str());
+ continue;
}
We applied this locally (on commit 2145525a4081d66ff1a87cf43ef809f95a85ac0c) and confirmed it resolves the issue end-to-end with a real Codex CLI session: the additional_tools item is now skipped with a warning log line, and the rest of the conversation (actual user message, tool calls, tool results) is processed normally.
Happy to open a PR with this change (plus a regression test fixture using the additional_tools item shape above) if that's useful — just wanted to flag the root cause and the minimal fix first in case there's a reason it wasn't handled this way already (e.g. if there's a reason some unrecognized item types should be fatal).
Environment
- llama.cpp commit:
2145525a4081d66ff1a87cf43ef809f95a85ac0c - Server:
llama-server, started with--jinja - Client: Codex CLI (
wire_api = "responses"), server-side feature flagscode_mode_host/unified_exec - OS: Ubuntu 24.04 LTS
- Dominant language
- C++
- Stars
- 132k
- Forks
- 24.6k
- Avg merge
- 2d 2m
- Merged PRs (30d)
- 498
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ggml-org/llama.cpp
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
Misc. bug: Metal aborts on MUL_MAT with BF16 src1 at K >= 64, batch > 8 (no BF16 mul_mm kernel)Openbug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ggml-org/llama.cpp#30973 · 1 comment ·
Maintainers usually reply within 1 day
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Misc. bug: Sarvam 30B MoE converter labels byte-fallback tokens <0x00>–<0xFF> NORMAL instead of BYTEOpenbug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
All issues in ggml-org/llama.cpp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
foxglove/mcap#1907 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Documentation
Difficulty 1/5 1-3 hours Newbie friendliness 72/100
qbittorrent/qBittorrent#25127 · 1 comment ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
telegramdesktop/tdesktop#31505 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day