Skip to content

[Bug]Critical issue : It causes a complete freeze.Opening projects fails with ENAMETOOLONG error. #22538

@thisxiangyu

Description

@thisxiangyu

Description

Bug Report

Problem

The issue has been identified.It appeared after my update and likely originates from this commit (264418c):
fix(snapshot): complete gitignore respect for previously tracked files ([#22172]

Description

On Windows, when a worktree has many ignored files (e.g., 75,000+), the snapshot add() function fails with ENAMETOOLONG error. This happens because git check-ignore --no-index is called with all file paths as command-line arguments, exceeding Windows' 32KB command-line limit.

Cause Detail

In packages/opencode/src/snapshot/index.ts , the add(), patch(), and diffFull() functions call: git check-ignore --no-index -- ...
When there are many ignored files, the command line becomes too long for Windows.

Solution

Replace git check-ignore --no-index with local ignore library (already used elsewhere in the codebase at src/file/index.ts). The ignore library provides equivalent gitignore pattern matching without command-line length limits.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)perfIndicates a performance issue or need for optimizationwindows

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions