Incomplete tool-call JSON makes the next llama.cpp turn fail

An injected incomplete-call fixture caused HTTP 500 when replayed in history. Validating the whole tool turn before committing it kept the original task recoverable.

Qualified 2026-10-16 Pacific · Same-agent local repeatability

Qualified 2026-10-16 Pacific on llama.cpp 0.6.0 build 11429 (d81235049), Qwen3-4B Q4_K_M; exact artifact SHA-256 in the package.

Apple M4 Pro, 24 GiB unified memory, macOS 26.3; CPU only, two threads, one slot, 2048-token context; loopback/offline.

For each repair, the same agent completed two seven-trial sequences in fresh server processes on the same Mac. Unchanged passing case runs were reused; the evidence index identifies them.

Same-agent repeatability checks on one Mac; no independent operator, second machine or human acceptance test.

Download full evidence cohort

412,621 bytes

SHA-256: 8a3e0d0b0f217f30e583450c7073dd1558ce75b9bb8f0e3e8f348e6260a28b93

Observed symptom

The following request returns HTTP 500: Failed to parse tool call arguments as JSON after incomplete function arguments such as { enter conversation history.

Correction

Stage the whole tool turn outside committed history. Require a complete tool_calls finish, the expected tool identity and valid original arguments before committing or executing it. Discard the failed staged turn and retry the unchanged original request.

  1. Keep a copy of the last valid conversation checkpoint. Treat stream deltas as provisional.
  2. Use complete_call in client_fixes.py with the fixture contract to reject unfinished or malformed arguments before any history mutation or tool result.
  3. Retry the unchanged original array-of-object request from the valid checkpoint; preserve both item objects and counts.
  4. Supply one synthetic stock result using the actual returned call ID. Require Stock total: 37. and a successful following turn.
  5. For an already-corrupted conversation, restore a known valid checkpoint using the failed turn provenance. Do not delete arbitrary real history or report a failed operation as successful.

Results

In each of two fresh-process runs: 0/3 baseline task passes, 3/3 corrected passes and 0/1 reverted passes. All original task checks and scoped completion checks passed. The offline audit recomputed acceptance from raw responses and rejected six damaged corrected-response controls.

Failed attempts and controls

The portable array-of-object control already completed successfully, so it was not counted as an upstream parser failure. Replaying the injected incomplete JSON did reproduce a separate current HTTP 500.

Limits

Same-agent repeatability checks on one Mac; no independent operator, second machine or human acceptance test.

Fixed synthetic tasks selected after exploration. The repeat counts do not establish a general reliability rate or support for other models and builds.

Runtime binaries and model weights are excluded. Exploratory failures, the failed first qualification fixture and all final trial responses are retained.

Client demonstrations identify owned reference integrations and injected inputs explicitly; they are not claims of a repaired Open WebUI release or a general llama.cpp bug fix.

The baseline uses an explicitly injected incomplete-call history fixture. It does not establish that the installed model or tagged parser generated that bad history.

Array-of-object tool calls already worked on this installed model. This is a client commit/retry correction, not a fix to the upstream tagged argument parser.

The supplied validator covers the owned fixture contract. A production client needs its own schemas, tool permissions and duplicate-execution handling.

Evidence

The ZIP includes exact requests, raw responses, the indexed complete case runs, failed initial attempts, frozen runner/client code, the offline audit, all file checksums and the selection record. It contains no model weights or runtime binary.

Primary protocol or upstream reference. The current result above is limited to the identified artifacts and fixture.

Read this repair in Fix Finder →