-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Prerequisites
- I have searched existing issues to avoid duplicates
- I am using the latest version of oh-my-opencode
- I have read the documentation
Bug Description
Ollama-based agents fail with JSON Parse error: Unexpected EOF when attempting tool calls. The root cause is that oh-my-opencode uses stream: true when calling Ollama API, but Ollama returns NDJSON (newline-delimited JSON) for streaming responses which cannot be parsed as a single JSON object.
Steps to Reproduce
- Configure oh-my-opencode to use Ollama provider with a local model (e.g.,
qwen3-coder,ministral-3:14b) - Invoke any agent that uses tools (e.g., explore agent)
- Agent attempts a tool call
- Error occurs during response parsing
Direct reproduction with curl:
# This works (stream: false)
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3-coder", "messages": [{"role": "user", "content": "Read file README.md"}], "stream": false, "tools": [{"type": "function", "function": {"name": "read", "description": "Read a file", "parameters": {"type": "object", "properties": {"filePath": {"type": "string"}}, "required": ["filePath"]}}}]}'
# This fails when parsed as single JSON (stream: true returns NDJSON)
curl -s http://localhost:11434/api/chat -d '{"model": "qwen3-coder", "messages": [{"role": "user", "content": "Read file README.md"}], "stream": true, "tools": [...]}'Expected Behavior
Ollama agents should work the same as cloud agents - tool calls should be parsed correctly regardless of streaming mode.
Actual Behavior
Agent invocation fails with:
JSON Parse error: Unexpected EOF
The streaming response returns multiple NDJSON lines:
{"message":{"tool_calls":[{"function":{"name":"read","arguments":{"filePath":"README.md"}}}]}, "done":false}
{"message":{"content":""}, "done":true}This cannot be parsed as a single JSON object.
Doctor Output
# Unable to run doctor - this is a development/testing environment
# The issue is reproducible with direct Ollama API callsError Logs
JSON Parse error: Unexpected EOFConfiguration
{
"provider": "ollama",
"model": "qwen3-coder"
}Additional Context
Suggested fixes:
- Simple fix: Use
stream: falsefor Ollama provider - Better fix: Parse NDJSON properly by splitting on newlines and merging tool_calls
Related:
- Ollama API docs: https://github.com/ollama/ollama/blob/main/docs/api.md
Operating System
Linux (Ubuntu 22.04)
OpenCode Version
Latest (tested with oh-my-opencode plugin)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working