[Bug] Assistant is retuning "path:xyz" instead of response
Description
Hello Team,
My nanocoder is returning output like:
## Assistant
{"path":"frontend/src/App.jsx","max_lines":200}
instead of actually do something. Is it a bug, or just a skill issue ?
Environment
- OS: Ubuntu 24.04.3 LTS
- Node version: Node.js version: v22.21.1
- Nanocoder version: 1.18.0
- Provider: Ollama
- Model: gpt-oss:20b
Steps to Reproduce
1.Download LLM Counclil project from github: https://github.com/karpathy/llm-council
2.Setup nanocoder and ask to run the app
Expected Behavior
nanocoder can anaylze and run the app
Actual Behavior
## Assistant
{"path":"frontend/src/App.jsx","max_lines":200}
Logs/Screenshots
---
session_date: 2025-12-09T20:00:43.749Z
provider: ollama-gpt
model: gpt-oss:20b
total_tokens: 245
---
# Nanocoder Chat Export
## User
hi, can you pelase run the app ? it should be avaiable outside of the machine (we are on the server)
## Assistant
I’m ready to help. What would you like to do next?
## User
i, can you pe
## Assistant
Could you specify what you’d like to do with the project?
## User
can you run the app ?
## Assistant
Could you let me know what change or feature you’d like to add or modify in the repository?
## User
can you check if app can be launched for users outsidde of the machine ?
## Assistant
{"path":"frontend/src/App.jsx","max_lines":200}
## User
an you check if app
## Assistant
I’m ready to help with any questions or tasks you have about the project. Let me know what you’d like to work on.
## User
can you pelase check if app can run outside of the machine ? And just run it if possible ?
## Assistant
{"path":"backend/config.py","line_start":1,"line_end":200}
Additional Context
- [X] I have searched existing issues to ensure this is not a duplicate
- [ ] I can reproduce this issue consistently
- [X] This issue occurs with the latest version of nanocoder
Hey @pawelwiejkut - thanks for sending this through. It looks like gpt-oss-20b is trying to do JSON tool calls in a format that isn't being caught. I'll look at this though it's not always easy to reproduce.
I've worked with gpt-oss:20b and encountered this exact issue. The model sometimes outputs raw JSON without proper Harmony format markers.
Expected (proper Harmony):
<|channel|>commentary to=functions.read code<|message|>{"path":"App.jsx","max_lines":200}
What you're seeing (raw JSON):
{"path":"frontend/src/App.jsx","max_lines":200}
Suggested fixes:
-
JSON Recovery Fallback - When format parsing fails, attempt to extract and parse raw JSON objects that match tool schemas
-
Correction Feedback Loop - Send structured error feedback to the model:
TOOL_CALL_ERROR: Format not recognized HINT: Use Harmony format: <|channel|>commentary to=TOOL code<|message|>{args}Then allow retry (with limits to prevent infinite loops)
-
System Prompt Reinforcement - Include explicit Harmony format examples in the tool calling prompt
Investigation Complete: Issue Can Be Closed ✅
After reviewing the current main branch, all three suggested solutions from this issue have been implemented:
1. JSON Recovery Fallback ✅
Implemented in PR #124
source/tool-calling/json-parser.ts-parseJSONToolCalls()extracts raw JSON tool callsdetectMalformedJSONToolCall()catches incomplete/malformed patterns- Handles markdown code blocks, embedded JSON, and various formats
2. Error Feedback Loop ✅
Implemented in PR #188 (refactor/chat-handler-split)
source/hooks/chat-handler/conversation/conversation-loop.tsx(lines 127-169)- Detects malformed tool calls, displays error, and sends feedback to model for self-correction
- Recursive retry mechanism allows models to fix their own formatting errors
3. System Prompt Enhancement ✅
Implemented in PR #124
source/app/prompts/main-prompt.md(line 28)- Explicitly instructs: "Use only native tool calling (no text-based formats like
[tool_use]or<function>)"
Related PRs
| PR | Description |
|---|---|
| #124 | Upgrade AI-SDK to v6 beta for multistep tool calling - Added tool-calling infrastructure |
| #188 | Split useChatHandler into focused modules - Added malformed tool call self-correction loop |
| #87 | Improve error handling for Ollama JSON parsing errors |
The codebase now gracefully handles raw JSON outputs like {"path":"xyz"} with detection, error feedback, and automatic retry mechanisms. Models that bypass proper formatting will receive correction prompts and retry.
Recommend closing this issue.