You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tool apply_patch messes up line endings in windows #37090
Editing files with Opencode messes up line endings in files in Windows.
Per default line endings in Windows are CRLF. However, opencode introduces LF line endings when using the builtin tool apply_patch. As I'am this problem occurs also for tool write.
Afaik a suitable merge request: #20217
This issue is related to #6348 which has been closed automatically. However, it is still a annoying issue.
Besides that I want to thank you for the amazing project!
Plugins
No response
OpenCode version
1.17.20
Steps to reproduce
Use an existing code file with CRLF line endings.
I use GPT 5.4 as model
Use a suitable prompt such that a code line will be added.
This new line should have LF endings instead of CRLF.
Several of these were closed. If the underlying issue has not been fixed, it may be worth linking to those threads or reopening the most relevant one rather than filing a new report.
I ran into this issue too, and a number of my AI sessions dragged on unnecessarily while the model was trying to restore CRLF line endings across all the modified files.
FWIW, I’m currently using a plugin to work around the shortcomings of the native OpenCode tool.
The plugin only works for changes made within the OpenCode session working directory.
It preserves line endings and ensures typical platform line endings for new files. It is available via npm such that one can easily use it via config. It is compatible with V2.
However, I would prefer if opencode fixes this issue.
Activity
github-actions commentedon Jul 15, 2026
This issue might be a duplicate of existing issues. Please check:
Several of these were closed. If the underlying issue has not been fixed, it may be worth linking to those threads or reopening the most relevant one rather than filing a new report.
Stefan-Bachmann commentedon Jul 15, 2026
As described: It is directly related to #6348 However, this issue has been closed automatically but not resolved.
A related merge request is #20217
Mac-Moneysac commentedon Aug 11, 2026
This issue is still present in 1.18.16 - It is really annoying :(
Mac-Moneysac commentedon Aug 28, 2026
#45931 might resolve this issue, too
Stefan-Bachmann commentedon Sep 28, 2026
This issue is still a thing in opencode v2 :(
jeckyhl commentedon Oct 1, 2026
I ran into this issue too, and a number of my AI sessions dragged on unnecessarily while the model was trying to restore CRLF line endings across all the modified files.
FWIW, I’m currently using a plugin to work around the shortcomings of the native OpenCode tool.
The plugin only works for changes made within the OpenCode session working directory.
https://github.com/jeckyhl/jeckyhl-opencode-plugins
Mac-Moneysac commentedon Oct 1, 2026
Hi,
I've solved it with a plugin, too: https://github.com/Mac-Moneysac/opencode-fix-line-endings
It preserves line endings and ensures typical platform line endings for new files. It is available via npm such that one can easily use it via config. It is compatible with V2.
However, I would prefer if opencode fixes this issue.
Thank you for your support☺️ !
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊