Skip to content

Weird error with toolcalling on local model #6649

Description

@pwilkin

Description

I was testing a local model (IQuest-Coder-40B-Instruct) to check how well it handles agentic coding. However, in OpenCode I'm getting:

AI_InvalidResponseDataError: Expected 'function.name' to be a string.

I thought it was the model being obtuse or maybe my parser not working correctly (I'm using an experimental parser for Llama.cpp), so I put an MITM proxy to capture the deltas. Here are the logs:

data: {"choices":[{"finish_reason":null,"index":0,"delta":{"role":"assistant","content":null}}],"created":1767366981,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"id":"TeCh7VHcc8zpP5G4zN5f0NKRppnBIOwT","type":"function","function":{"arguments":""}}]}}],"created":1767366982,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"id":"TeCh7VHcc8zpP5G4zN5f0NKRppnBIOwT","type":"function","function":{"name":"bash","arguments":"{"}}]}}],"created":1767366985,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\""}}]}}],"created":1767366988,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"command"}}]}}],"created":1767366988,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]}}],"created":1767366989,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]}}],"created":1767366990,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"ls"}}]}}],"created":1767366990,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" -"}}]}}],"created":1767366991,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"la"}}]}}],"created":1767366991,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\","}}]}}],"created":1767366992,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]}}],"created":1767366992,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"description"}}]}}],"created":1767366993,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\":"}}]}}],"created":1767366994,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" \""}}]}}],"created":1767366994,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"List"}}]}}],"created":1767366996,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" files"}}]}}],"created":1767366997,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" in"}}]}}],"created":1767366997,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" current"}}]}}],"created":1767366998,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":" directory"}}]}}],"created":1767366998,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":null,"index":0,"delta":{"tool_calls":[{"index":0,"function":{"arguments":"\"}"}}]}}],"created":1767367000,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[{"finish_reason":"tool_calls","index":0,"delta":{}}],"created":1767367005,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk"}
data: {"choices":[],"created":1767367005,"id":"chatcmpl-q7mP1rgtuJhfQWiVh6lrBQsS4SZcuwKT","model":"IQuest-Coder-V1-40B-Instruct-IQ4_XS.gguf","system_fingerprint":"b7638-73c7088d3","object":"chat.completion.chunk","usage":{"completion_tokens":31,"prompt_tokens":11020,"total_tokens":11051},"timings":{"cache_n":10245,"prompt_n":775,"prompt_ms":225787.145,"prompt_per_token_ms":291.3382516129032,"prompt_per_second":3.432436332901061,"predicted_n":31,"predicted_ms":23536.925,"predicted_per_token_ms":759.2556451612903,"predicted_per_second":1.3170794400712922}}
data: [DONE]

This looks to be a perfectly valid tool call - why isn't it getting accepted?

OpenCode version

1.0.223

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Ubuntu 25.10

Terminal

Terminology

Activity

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

Metadata

Metadata

Assignees

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