claude-code - 💡(How to fix) Fix Opened documents show stale version after amendment [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45520Fetched 2026-04-09 08:03:30
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Timeline (top)
labeled ×3

When Claude Code amends a document (PDF, Word, Excel) and opens it via open command, the application frequently displays an older/cached version of the file rather than the latest amended version. The user has to manually close the document and ask Claude to reopen it to see the current version.

Root Cause

When Claude Code amends a document (PDF, Word, Excel) and opens it via open command, the application frequently displays an older/cached version of the file rather than the latest amended version. The user has to manually close the document and ask Claude to reopen it to see the current version.

Fix Action

Workaround

Currently using osascript -e 'tell application "Microsoft Excel" to quit' (or equivalent) followed by a sleep and then open to force a fresh open. This works but shouldn't be necessary.

RAW_BUFFERClick to expand / collapse

Summary

When Claude Code amends a document (PDF, Word, Excel) and opens it via open command, the application frequently displays an older/cached version of the file rather than the latest amended version. The user has to manually close the document and ask Claude to reopen it to see the current version.

Steps to Reproduce

  1. Have Claude generate or amend a document (e.g., Excel file at /tmp/example.xlsx)
  2. Claude opens the file with open /tmp/example.xlsx
  3. Make further amendments to the same file path (overwrite with updated content)
  4. Claude runs open /tmp/example.xlsx again
  5. The application (Excel, Preview, Word) shows the previous version, not the newly written file

Expected Behaviour

The most recently written version of the file should be displayed when opened.

Actual Behaviour

The previously cached/opened version is displayed. Requires the user to ask Claude to quit the application and reopen, or manually close and reopen themselves.

Workaround

Currently using osascript -e 'tell application "Microsoft Excel" to quit' (or equivalent) followed by a sleep and then open to force a fresh open. This works but shouldn't be necessary.

Environment

  • macOS (Darwin 25.3.0)
  • Claude Code CLI
  • Affects: Excel (.xlsx), Word (.docx), Preview (.pdf) — observed across multiple file types
  • Experienced multiple times in a single session

Impact

Causes confusion and wasted time as the user reviews outdated content thinking it's the latest version, then has to go back and forth to get the correct file open.

extent analysis

TL;DR

The issue can likely be resolved by ensuring the file is properly closed or the application is quit before attempting to open the updated version, potentially through a more robust automation of the workaround.

Guidance

  • Verify File Locks: Check if the file is being locked by the application or Claude Code, preventing the updated version from being displayed.
  • Improve Workaround: Instead of using osascript to quit the application, consider using a more direct method to close the file, such as using the application's API if available.
  • Check for Cache: Investigate if there's a cache mechanism in the application or the operating system that's causing the older version to be displayed, and see if it can be cleared or disabled.
  • Automation: Automate the process of closing the application, waiting, and then reopening the file to ensure consistency and reduce user interaction.

Example

# Example of automating the workaround
#!/bin/bash
osascript -e 'tell application "Microsoft Excel" to quit'
sleep 2
open /tmp/example.xlsx

Notes

The provided workaround suggests that the issue is related to the application not properly releasing the file or updating its internal state when the file is modified. The solution may involve finding a more elegant way to handle this, potentially through the application's API or by modifying Claude Code's behavior.

Recommendation

Apply workaround: The current workaround, although not ideal, does resolve the issue. Improving this workaround to make it more seamless and less intrusive for the user could be a viable short-term solution until a more permanent fix is found.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Opened documents show stale version after amendment [1 participants]