[GH-ISSUE #12794] Tool Calling with Jan Nano #34246

Closed
opened 2026-04-22 17:41:03 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @trufae on GitHub (Oct 27, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12794

What is the issue?

Calling tools fails with many models, even the ones that in theory support tool calling.

here's one of the errors i get: ERROR: OpenAI API error response: {"error":"json: cannot unmarshal string into Go struct field ChatRequest.messages.tool_calls.function.arguments of type api.ToolCallFunctionArguments"}

this is the json received by the llm client:

i tried to force the model provide the type and id fields because thats probably why its failing. but i guess with that unmarshall error. ollama can do some fallbacks to make it work too.

this is the model im using: mannix/jan-nano

Relevant log output

API response: {"model":"mannix/jan-nano:latest","created_at":"2025-10-27T22:52:35.51723696Z","message":{"role":"assistant","content":"","thinking":"Okay, the user is asking for the address of the main function in the binary. Let me recall what I know about radare2 and how to find the main function.\n\nFirst, the binary is an ARM64 architecture, and it's a Mach-O file. The main function in such binaries is usually named \"main\" and is the entry point. But how do I find its address?\n\nIn radare2, the command 'aa' is used to analyze the binary and display the function list. The 'af' command shows the functions, and the main function is often listed there. Alternatively, the entry point can be found with 'af' or 'afl' (function list). \n\nWait, the user might be expecting me to use specific commands. Let me think: when you load a binary in radare2, the entry point is usually at 0x100000000, but the main function could be different. But in the given information, the baddr is 0x100000000, which is the base address of the binary. However, the main function's address might be within the binary's code section.\n\nSo, the steps would be: first, analyze the binary with 'aa' to get the function list. Then, look for the function named 'main' in the list. The address would be the start of that function. Alternatively, if the main function is not named 'main', maybe it's called something else, but in standard C programs, it's usually 'main'.\n\nAlternatively, using the 'af' command to list all functions and find the main function. The address would be the value in the 'addr' column for the main function.\n\nBut since the user is asking for the address, maybe the answer is 0x100000000, but that's the base address. Wait, no, the main function's address is different. Let me check. In the given information, the binary's base address is 0x100000000, but the main function's address is probably within the binary's code section. So, I need to use radare2 commands to find it.\n\nSo, the correct approach is to run 'aa' to analyze the binary, then 'af' to list functions, and look for 'main'. The address would be the start of that function. Alternatively, if the main function is not named 'main', maybe it's called something else, but in standard cases, it's 'main'.\n\nTherefore, the answer should be the address of the 'main' function, which can be found using 'aa' and 'af' commands. But since the user is asking for the address, I need to execute these commands to get the exact value.\n","tool_calls":[{"function":{"index":0,"name":"r2cmd","arguments":{"command":"aa"}}}]},"done":true,"done_reason":"stop","total_duration":26696860454,"load_duration":198597062,"prompt_eval_count":869,"prompt_eval_duration":75460968,"eval_count":605,"eval_duration":26043564492}

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

ollama version is 0.12.6

Originally created by @trufae on GitHub (Oct 27, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12794 ### What is the issue? Calling tools fails with many models, even the ones that in theory support tool calling. here's one of the errors i get: `ERROR: OpenAI API error response: {"error":"json: cannot unmarshal string into Go struct field ChatRequest.messages.tool_calls.function.arguments of type api.ToolCallFunctionArguments"}` this is the json received by the llm client: i tried to force the model provide the type and id fields because thats probably why its failing. but i guess with that unmarshall error. ollama can do some fallbacks to make it work too. this is the model im using: `mannix/jan-nano` ### Relevant log output ```shell API response: {"model":"mannix/jan-nano:latest","created_at":"2025-10-27T22:52:35.51723696Z","message":{"role":"assistant","content":"","thinking":"Okay, the user is asking for the address of the main function in the binary. Let me recall what I know about radare2 and how to find the main function.\n\nFirst, the binary is an ARM64 architecture, and it's a Mach-O file. The main function in such binaries is usually named \"main\" and is the entry point. But how do I find its address?\n\nIn radare2, the command 'aa' is used to analyze the binary and display the function list. The 'af' command shows the functions, and the main function is often listed there. Alternatively, the entry point can be found with 'af' or 'afl' (function list). \n\nWait, the user might be expecting me to use specific commands. Let me think: when you load a binary in radare2, the entry point is usually at 0x100000000, but the main function could be different. But in the given information, the baddr is 0x100000000, which is the base address of the binary. However, the main function's address might be within the binary's code section.\n\nSo, the steps would be: first, analyze the binary with 'aa' to get the function list. Then, look for the function named 'main' in the list. The address would be the start of that function. Alternatively, if the main function is not named 'main', maybe it's called something else, but in standard C programs, it's usually 'main'.\n\nAlternatively, using the 'af' command to list all functions and find the main function. The address would be the value in the 'addr' column for the main function.\n\nBut since the user is asking for the address, maybe the answer is 0x100000000, but that's the base address. Wait, no, the main function's address is different. Let me check. In the given information, the binary's base address is 0x100000000, but the main function's address is probably within the binary's code section. So, I need to use radare2 commands to find it.\n\nSo, the correct approach is to run 'aa' to analyze the binary, then 'af' to list functions, and look for 'main'. The address would be the start of that function. Alternatively, if the main function is not named 'main', maybe it's called something else, but in standard cases, it's 'main'.\n\nTherefore, the answer should be the address of the 'main' function, which can be found using 'aa' and 'af' commands. But since the user is asking for the address, I need to execute these commands to get the exact value.\n","tool_calls":[{"function":{"index":0,"name":"r2cmd","arguments":{"command":"aa"}}}]},"done":true,"done_reason":"stop","total_duration":26696860454,"load_duration":198597062,"prompt_eval_count":869,"prompt_eval_duration":75460968,"eval_count":605,"eval_duration":26043564492} ``` ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version ollama version is 0.12.6
GiteaMirror added the bug label 2026-04-22 17:41:03 -05:00
Author
Owner

@rick-github commented on GitHub (Oct 27, 2025):

What client are you using to make the request to the model and process the returned tool call?

<!-- gh-comment-id:3453724262 --> @rick-github commented on GitHub (Oct 27, 2025): What client are you using to make the request to the model and process the returned tool call?
Author
Owner

@trufae commented on GitHub (Oct 28, 2025):

Im writing my own one. This is r2ai, but i have similar problems when using opencode or other coding agents that when using ollama sometimes it just stops working with an empty response, so im trying to debug this problem. I can maybe tomorrow find some time to reduce the problem to a curl oneliner

<!-- gh-comment-id:3454140077 --> @trufae commented on GitHub (Oct 28, 2025): Im writing my own one. This is r2ai, but i have similar problems when using opencode or other coding agents that when using ollama sometimes it just stops working with an empty response, so im trying to debug this problem. I can maybe tomorrow find some time to reduce the problem to a curl oneliner
Author
Owner

@liduo1997love commented on GitHub (Nov 14, 2025):

in openai sdk api.ToolCallFunctionArguments is string, but ollama requair a Object

<!-- gh-comment-id:3531670115 --> @liduo1997love commented on GitHub (Nov 14, 2025): in openai sdk api.ToolCallFunctionArguments is string, but ollama requair a Object
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#34246