Error message: JSON Parse error: Unterminated string] error with Kimi k 2.5 and huggingface provider in build mode #8726

Open
opened 2026-02-16 18:10:40 -05:00 by yindo · 1 comment
Owner

Originally created by @aditya-oss-prog on GitHub (Feb 6, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

build mode edit tool fails with JSON Parse error on large multi-line newString payloads

Bug Summary

after planning build model fails with a JSON Parse error: Unterminated string when the newString parameter contains a large multi-line payload with embedded code blocks, markdown formatting, and escaped characters. The JSON serialization of the edit payload appears to produce an unterminated string, causing the JSON parser to reject the input before the tool can execute.

Error Message

 invalid [tool=edit, error=Invalid input for tool edit: JSON parsing failed: 
Text: {"filePath": "IMPLEMENTATION_PLAN.md", "oldString": "**Document Version**: 1.0\n**Last Updated**: ..."}
Error message: JSON Parse error: Unterminated string]

Plugins

No plugins just opencode with huggingface provider

OpenCode version

1.1.40

Steps to reproduce

  1. create a plan in plan mode.

  2. ask it to write to file in build mode it can be implementation plan file or any code file.

Screenshot and/or share link

No response

Operating System

macos Tahoe 26.2 and ubuntu 24.04 in wsl

Terminal

macos default terminal and windows terminal wsl window

Originally created by @aditya-oss-prog on GitHub (Feb 6, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description ## build mode edit tool fails with JSON Parse error on large multi-line `newString` payloads ### Bug Summary after planning build model fails with a `JSON Parse error: Unterminated string` when the `newString` parameter contains a large multi-line payload with embedded code blocks, markdown formatting, and escaped characters. The JSON serialization of the edit payload appears to produce an unterminated string, causing the JSON parser to reject the input before the tool can execute. ### Error Message ```javascript ⚙ invalid [tool=edit, error=Invalid input for tool edit: JSON parsing failed: Text: {"filePath": "IMPLEMENTATION_PLAN.md", "oldString": "**Document Version**: 1.0\n**Last Updated**: ..."} Error message: JSON Parse error: Unterminated string] ``` ### Plugins No plugins just opencode with huggingface provider ### OpenCode version 1.1.40 ### Steps to reproduce 1. create a plan in plan mode. 2. ask it to write to file in build mode it can be implementation plan file or any code file. ### Screenshot and/or share link _No response_ ### Operating System macos Tahoe 26.2 and ubuntu 24.04 in wsl ### Terminal macos default terminal and windows terminal wsl window
yindo added the windowsbug labels 2026-02-16 18:10:40 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 6, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #10755: JSON Parse error: Unterminated string with gpt-5.2-codex model - same error message occurring during plan+build workflow
  • #11630: Write tool JSON parsing error with large files and special characters - reports unterminated string errors when writing content with embedded code blocks
  • #12412: Plan mode unable to save due to malformed write payload - malformed JSON in write tool with large payloads, similar root cause
  • #12425: JSON Parse error: Expected '}' - similar JSON parsing failures when writing files with large content

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 6, 2026): This issue might be a duplicate of existing issues. Please check: - #10755: JSON Parse error: Unterminated string with gpt-5.2-codex model - same error message occurring during plan+build workflow - #11630: Write tool JSON parsing error with large files and special characters - reports unterminated string errors when writing content with embedded code blocks - #12412: Plan mode unable to save due to malformed write payload - malformed JSON in write tool with large payloads, similar root cause - #12425: JSON Parse error: Expected '}' - similar JSON parsing failures when writing files with large content Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8726