Skip to content

Line ending issue with fs/write_file in Opencode 2 #50740

Closed

Description

@klonuo

Description

I use Opencode through ACP

In version 1, Opencode uses it's own editing capabilities which worked fine, while in version 2 it uses fs/write_file which messes line endings

My files have LF line endings. Let me quote the agent:

The `edit` tool inflated CRLF files with blank lines on repeated edits; 
I restored from git and re-applied all 29 replacements via a newline-preserving script — 
final diff is 70 insertions / 21 deletions across 9 files.
Worth keeping in mind for future edits on this repo.

Plugins

No response

OpenCode version

2.0.12

Steps to reproduce

My environment is a project on Windows with LF file line endings (so no default CRLF for Windows as it may be expected)

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

No response

Activity

  1. github-actions commented on Sep 22, 2026

    @github-actions
    Contributor

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

    If your issue is specifically about fs/write_file in v2 behaving differently from v1, please clarify that distinction in the existing issues or confirm this is a new regression.

  2. klonuo commented on Sep 22, 2026

    @klonuo
    Author

    Yes, issue is specifically about fs/write_file in v2 behaving differently from v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions