Ollama μ¬μ© μ JSON Parse error: Unexpected EOFκ° λλ λ¬Έμ λ₯Ό μμΈ-ν΄κ²° μμλ‘ λ€λ£Ήλλ€.
λΉ λ₯΄κ² μ€ν (볡λΆ)
{"provider":"ollama","model":"qwen3-coder","stream":false}
curl -s http://localhost:11434/api/chat -d ...flowchart TD A[stream=true] --> B[NDJSON] B --> C[JSON νμ± μ€ν¨] C --> D[Unexpected EOF] D --> E[stream=false]
λ¨κ³λ³ μ μ©
1) μ¦μ νμΈ
- μ€λͺ : tool call μ Unexpected EOFκ° λ°μνλ©΄ μ΄ μΌμ΄μ€λ₯Ό μμ¬ν©λλ€.
- μ€ν μμ:
{"provider":"ollama","model":"qwen3-coder","stream":false}
2) μμΈ νμ
- μ€λͺ : Ollamaλ stream=trueμμ NDJSONμ λ°ννκ³ , SDKλ λ¨μΌ JSON κΈ°λλ‘ νμ± μ€ν¨ν©λλ€.
- μ€ν μμ:
curl -s http://localhost:11434/api/chat -d ...
3) μ¦μ ν΄κ²°
- μ€λͺ : provider μ€μ μ stream:falseλ₯Ό μ μ©ν©λλ€.
- μ€ν μμ:
curl -s http://localhost:11434/api/chat -d ...
4) κ²μ¦
- μ€λͺ : curl ν μ€νΈλ‘ tool call μλ΅μ νμΈν©λλ€.
- μ€ν μμ:
curl -s http://localhost:11434/api/chat -d ...
5) μ₯κΈ° λμ
- μ€λͺ : SDK μ΄μ νΈλ컀λ₯Ό ꡬλ νκ³ λ²μ μ λ°μ΄νΈλ₯Ό νμΈν©λλ€.
- μ€ν μμ:
curl -s http://localhost:11434/api/chat -d ...
λΆλ‘) μλ¬Έ μ½λ μ€λν« (κ²μμ©, μ΄λ³΄μλ 건λλ°κΈ°)
{"message":{"tool_calls":[{"function":{"name":"read","arguments":{"filePath":"README.md"}}}]}, "done":false}
{"message":{"content":""}, "done":true}{
"provider": "ollama",
"model": "qwen3-coder",
"stream": false
}# Test with curl (should work with 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"]}}}]
}'λ§λ¬΄λ¦¬ 체ν¬
- μ βλΉ λ₯΄κ² μ€νβ λͺ λ Ήμ μ΅μ 1κ° μ€ννλ€.
- μ€ν¨ μ βμλ¬Έ μ€ν μ½λ νμ₯βμ κ΄λ ¨ μ½λλ₯Ό μ¬μ©ν΄ μ¬κ²μ¦νλ€.
- μλ³Έ νλͺ© λμ‘° μΈλ±μ€μμ λΉ μ§ κΈ°λ₯μ΄ μλμ§ νμΈνλ€.
μΆμ²
- μλ¬Έ(λ‘컬):
oh-my-opencode/docs/troubleshooting/ollama-streaming-issue.md - μλ¬Έ(GitHub): https://github.com/code-yeongyu/oh-my-opencode/blob/dev/docs/troubleshooting/ollama-streaming-issue.md