Skip to content

Eval bug: Tool-calling fails with HTTP 400: tool_call.arguments|items receives String instead of object #112

Description

@roninpawn

Name and Version

version: 1 (9fcaed7)
built with MSVC 19.44.35228.0 for Windows AMD64

Operating systems

Windows

GGML backends

CUDA

Hardware

Ryzen 5 3600, RTX 3060 12GB

Models

Ternary-Bonsai-27B-Q2_0
Qwen3.5-9B-Q4_K_M

Problem description & steps to reproduce

PyCharm AI Assistant tool calling fails with HTTP 400: tool_call.arguments|items receives String instead of object

Environment

  • Windows 10

  • NVIDIA RTX 3060 12GB

  • CUDA driver reports CUDA 13.3

  • PyCharm 2026.2

  • JetBrains AI Assistant: 262.8665.403

  • PyCharm configured to use local OpenAI-compatible llama-server

  • PrismML llama.cpp build: version: 1 (9fcaed7) built with MSVC 19.44.35228.0 for Windows AMD64

  • Also reproduced with both:

    • PrismML Ternary Bonsai 27B Q2_0
    • Qwen3.5 9B Q4_K_M

Problem

Tool/agent use through JetBrains PyCharm AI Assistant fails after the model successfully processes the initial request.

The first model request completes normally. PyCharm receives the initial response/tool action, but the subsequent tool-calling turn fails with HTTP 400:

ai.koog.http.client.KoogHttpClientException: Error from client: OpenAILLMClient
Message: Expected status code 200 but was 400
Status code: 400
Error body:
{"error":{"code":400,"message":"Unable to generate parser for this template. Automatic parser generation failed:
------------
While executing FilterExpression at line 120, column 73 in source:
..._name, args_value in tool_call.arguments|items %}
                        {{- '<...
                                           ^
Error: Unknown (built-in) filter 'items' for type String","type":"invalid_request_error"}}

Corresponding PrismML llama-server output:

srv operator (): got exception: {"error":{"code":400,"message":"Unable to generate parser for this template. Automatic parser generation failed:
------------
While executing FilterExpression at line 120, column 73 in source:
..._name, args_value in tool_call.arguments|items %}
                        {{- '<...
                                           ^
Error: Unknown (built-in) filter 'items' for type String","type":"invalid_request_error"}}

Removing --jinja from the server command does not resolve the problem.

Reproduction

  1. Start PrismML llama-server with a supported model and expose the OpenAI-compatible endpoint.
  2. Configure PyCharm AI Assistant to use the local server.
  3. Give the AI a coding task requiring it to inspect/edit project files.
  4. Initial inference succeeds.
  5. When the agent/tool interaction continues, llama-server returns HTTP 400 while generating the parser.

This reproduced with two unrelated models: Ternary Bonsai 27B and Qwen3.5 9B.

Possible cause

The failing template expression is:

tool_call.arguments|items

The parser reports that tool_call.arguments is a String, while this template appears to expect an object/map whose entries can be iterated with items.

There has been an upstream llama.cpp report of the same parser failure with Qwen3.5, so this may be an already-fixed upstream issue that has not yet propagated into the PrismML fork, rather than something Bonsai-specific.

JetBrains Koog also previously had a bug that double-JSON-encoded function.arguments during multi-turn OpenAI-compatible tool calls. That issue has since been fixed upstream, and the currently installed JetBrains AI Assistant is 262.8665.403.

Most significantly, I tested the same Qwen3.5 9B GGUF with a current upstream llama.cpp Windows CUDA build, using the same PyCharm/AI Assistant setup. Tool use progressed successfully and PyCharm produced proposed file edits with an Apply action. The HTTP 400 above did not occur.

That seems to point toward the PrismML llama.cpp build/parser rather than PyCharm itself, although I have not isolated a specific PrismML/upstream commit.

Expected behavior

OpenAI-compatible multi-turn tool calls from PyCharm should be accepted, allowing the model to inspect files, propose edits, and continue the agent loop without the parser failing on tool_call.arguments.

Additional observation

Inference itself works correctly with the PrismML build, including CUDA acceleration. The failure occurs specifically during the multi-turn tool/agent interaction, after successful model inference.

First Bad Commit

No response

Relevant log output

srv operator (): got exception: {"error":{"code":400,"message":"Unable to generate parser for this template. Automatic parser generation failed:
------------
While executing FilterExpression at line 120, column 73 in source:
..._name, args_value in tool_call.arguments|items %}
                        {{- '<...
                                           ^
Error: Unknown (built-in) filter 'items' for type String","type":"invalid_request_error"}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions