Skip to content

fix(snapshot): handle info/exclude write failure gracefully instead of crashing session #37493

Description

@mgajda

Description

Snapshot.sync writes to info/exclude inside the snapshot gitdir with Effect.orDie, so any EACCES (e.g., from UID mismatch when the snapshot directory is shared between a container and the host, or from concurrent writes across sessions) crashes the SessionProcessor mid-conversation:

level=ERROR  message=failed
  ref=err_0f5486fc
  error="PlatformError: PermissionDenied: FileSystem.writeFile (.../info/exclude)
  cause="EACCES: permission denied, open .../info/exclude"

The snapshot functionality (excluding files via git exclude) is advisory — a write failure should log a warning and continue, not kill the session.

Plugins

None (stock install)

OpenCode version

0.0.0-local-patches-202607171343 (also affects released builds)

Steps to reproduce

  1. Run multiple opencode sessions that snapshot the same project concurrently
  2. Or run opencode inside a container where ~/.local/share/opencode/snapshot/ is mounted from the host with a UID shift
  3. Observe session crash with EACCES: permission denied on info/exclude

Screenshot and/or share link

Error excerpt from ~/.local/share/opencode/log/opencode.log:

level=ERROR  message="failed" ref=err_0f5486fc
  error="PlatformError: PermissionDenied: FileSystem.writeFile
  (.../snapshot/<id>/<hash>/info/exclude)
  cause="EACCES: permission denied, open .../info/exclude"

Stack: Snapshot.patch → SessionProcessor.cleanup → SessionPrompt.run

Operating System

Linux (Ubuntu 26.04)

Terminal

Alacritty

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

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