Skip to content

Bug: Tool calls with Object arguments are serialized as string #537

Description

@TatuLund

When using FastFlowLM with OpenCode and Gemma 4 E4B model, I observed frequent tool call failures, by inspecting the log I observed the likely cause to be wrong data serialization

        {
            "content": "",
            "role": "assistant",
            "tool_calls": [
                {
                    "function": {
                        "arguments": "{\"filePath\":\"./src/main/java/my/path/to/JavaClass.java\"}",
                        "name": "read"
                    },
                    "id": "call_1777830235_96",
                    "type": "function"
                },
                {
                    "function": {
                        "arguments": "{\"filePath\":\"./src/main/java/my/path/to/OtherClass.java\"}",
                        "name": "read"
                    },
                    "id": "call_1777830239_97",
                    "type": "function"
                }
            ]
        },

This results in error:

Invalid input for tool read: JSON parsing failed: Text: {{\\\"filePath\\\":\\\"./src/main/java/my/path/to/JavaClass.java\\\\"}}.
Error message: JSON Parse error: Expected '}'

Probably related to #483

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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