Skip to content

JSON Parse Error - Unterminated String on Write Tool #11531

@JacquesvanWyk

Description

@JacquesvanWyk

Description

Model: kimi-k2.5-free
Tool Affected: write (file write)
Error: JSON Parse error: Unterminated string
Summary
Large content strings (>4-5KB) with code blocks cause JSON parsing failures when using the write tool.
Reproduction

  1. Attempt to write file with content containing:
    • Markdown with SQL code blocks (triple backticks)
    • Unicode box-drawing characters (│ ├ └)
    • Length > 4000 characters
  2. JSON parser fails with "Error message: JSON Parse error: Unterminated string]"
    Suspected Causes
  • String length exceeding parser buffer
  • Improper escaping of nested quotes or backticks
  • Multibyte character handling issues
    Workaround
    Split content into smaller chunks (<3KB each) or use edit tool for incremental writes.
    Environment
  • Platform: darwin/macOS
  • Working with: Technical documentation, SQL schemas, code examples

Plugins

No response

OpenCode version

1.1.40

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS Tahoe Version 26.2

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions