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
Plugin cannot update FileTime after modifying files, causing "file modified since last read" errors #11249
Problem
When a plugin uses the tool.execute.after hook to modify files (e.g., running a formatter), subsequent write/edit operations on the same file fail with:
Error: File xxxxx has been modified since it was last read.
Last modification: 2026-01-30T03:53:46.637Z
Last read: 2026-01-30T03:53:35.616Z
Please read the file again before modifying it.
This happens even when the plugin has already read the file via the SDK client.
Root Cause
The plugin receives ctx.client which is an SDK client instance
The plugin can call ctx.client.read() to fetch file content after modifying it
However, calling ctx.client.read() does NOT update the FileTime tracking for the session
FileTime state is managed internally and only updated by the Read/Write/Edit tools themselves
Without a way for plugins to update FileTime, any external file modifications invalidate the timestamp tracking
Reproduction Steps
Create a plugin that modifies files in tool.execute.after:
Configure opencode to load this plugin
Open opencode and run: "Write a dummy file"
Plugin modifies the file after write completes
Error: "File has been modified since it was last read"
Current Workaround
Plugins can use the environment variable to disable FileTime checks:
export OPENCODE_DISABLE_FILETIME_CHECK=1
opencode
However, this:
Activity
github-actions commentedon Jan 30, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if this doesn't fully address your specific case.
github-actions commentedon Apr 1, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.