{"key":"ollama_gemma4_tool_call_parsing_bug","title":"Ollama Gemma4 Tool Call Parsing Bug — FIXED via Prompt Workaround","content":"## Bug Summary\nOllama versions 0.20.2 through at least 0.21.0 have a known parsing bug in model/parsers/gemma4.go affecting Gemma 4 tool calls.\n\n## Symptoms\n- `gemma4 tool call parsing failed error=\"invalid character '#' looking for beginning of value\"` (line 293)\n- `gemma4 tool call flush on done failed error=\"invalid character 'T' looking for beginning of value\"` (line 306)\n\n## Fix Applied (2026-04-19)\nApplied the OpenCode prompt workaround to `packages/opencode/src/session/prompt/default.txt`. \n\n### Changes:\nAdded a \"Tool Call Requirements\" section forcing the `<|\"` and `\"|>` delimiter format for all string arguments and lowercase booleans.\n\n### Build:\nRebuilt OpenCode using `bun run build --single --skip-embed-web-ui` and installed the updated binary to `/home/svc-admin/.nvm/versions/node/v24.14.0/bin/opencode`.\n\n### Verification:\nSmoke test passed on the new binary (v0.0.0-dev-202604190227). The model is now explicitly instructed to use the robust delimiter format to bypass the Ollama parser bug.\n","summary":"## Bug Summary\nOllama versions 0.20.2 through at least 0.21.0 have a known parsing bug in model/parsers/gemma4.go affecting Gemma 4 tool calls.\n\n## Symptoms\n- `gemma4 tool call parsing failed error=\"invalid character '#' looking for beginning of value\"` (line 293)\n- `gemma4 tool call flush on done failed error=\"invalid character 'T' looking for beginning of value\"` (line 306)\n\n## Fix Applied (2026-04-19)\nApplied the OpenCode prompt workaround to `packages/opencode/src/session/prompt/default.txt`. \n\n### Changes:\nAdded a \"Tool Call Requirements\" section forcing the `<|\"` and `\"|>` delimiter format for all string arguments and lowercase booleans.\n\n### Build:\nRebuilt OpenCode using `bun run build --single --skip-embed-web-ui` and installed the updated binary to `/home/svc-admin/.nvm/versions/node/v24.14.0/bin/opencode`.\n\n### Verification:\nSmoke test passed on the new binary (v0.0.0-dev-202604190227). The model is now explicitly instructed to use the robust delimiter format to bypass the Ollama parser bug.\n","status":"active","namespace":"opencode","namespace_name":"opencode","namespace_tier":"shared","tags":[]}