Model adds n from new line symbol to generated code #3084

Closed
opened 2026-02-16 17:38:32 -05:00 by yindo · 1 comment
Owner

Originally created by @pawelel on GitHub (Nov 24, 2025).

Description

Generated code has new line symbol added, which creates "n" at line start.
"\n"

OpenCode version

1.0.107

Steps to reproduce

Ask for code generation (longer code means more likely it will add new line symbol)
See the result.
I used gemini-5-mini. Custom instruction added to AGENTS.md didn't solve the issue.

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

pwsh within Windows Terminal, Terminal Reworked 2025 (IntelliJ)

Originally created by @pawelel on GitHub (Nov 24, 2025). ### Description Generated code has new line symbol added, which creates "n" at line start. "\n" ### OpenCode version 1.0.107 ### Steps to reproduce Ask for code generation (longer code means more likely it will add new line symbol) See the result. I used gemini-5-mini. Custom instruction added to AGENTS.md didn't solve the issue. ### Screenshot and/or share link <img width="201" height="117" alt="Image" src="https://github.com/user-attachments/assets/181386f7-75c4-4b82-b2b3-b382aae801de" /> ### Operating System Windows 11 ### Terminal pwsh within Windows Terminal, Terminal Reworked 2025 (IntelliJ)
yindo added the opentuibug labels 2026-02-16 17:38:32 -05:00
yindo closed this issue 2026-02-16 17:38:32 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 24, 2025):

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

  • #4530: Tools Fail to Unescape XML Entities - mentions that \n replaces newlines causing entire files to become one line, which appears to be the same root cause of generated code having literal \n characters added instead of proper newlines

Feel free to ignore if your specific case is different.

@github-actions[bot] commented on GitHub (Nov 24, 2025): This issue might be a duplicate of existing issues. Please check: - #4530: Tools Fail to Unescape XML Entities - mentions that `\n` replaces newlines causing entire files to become one line, which appears to be the same root cause of generated code having literal `\n` characters added instead of proper newlines Feel free to ignore if your specific case is different.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3084