/insights: clicking the report link shows 'Couldn't find this file' when file is outside the working directory
Bug report
Command: /insights
What happens:
The /insights slash command generates a usage report and returns a file:// link to the HTML file (e.g. file:///home/user/.claude/usage-data/report-YYYY-MM-DD-HHMMSS.html).
When the user clicks that link inside the Claude desktop app (Code tab), the app shows:
Couldn't find this file It may have been deleted, or it lives outside the working directory.
The file exists on disk and is readable; the problem is that the app only resolves links that are relative to the current working directory (or within it). Because /insights stores the report under ~/.claude/usage-data/ — outside any project folder — the link is always broken when the session has no project folder open (scratch workspace) or when the project folder is elsewhere.
Environment:
- Claude desktop app (Code tab), Linux
- Session working directory: scratch workspace (no project folder)
- Report path:
/home/user/.claude/usage-data/report-*.html
Expected behaviour: Clicking the link opens the HTML report, regardless of whether the file is inside or outside the current working directory.
Suggested fixes (pick one):
- Resolve
file://absolute paths in the desktop app without restricting to the working directory. - Have
/insightscopy or symlink the report into a location always accessible (e.g. a temp HTTP server, or the scratch workspace). - Open the report automatically in the system browser instead of rendering an in-app link.
Still reproduces on macOS, so this isn't Linux-only.
Environment: Claude desktop app 4.29.0 (Code tab), Claude Code 2.1.312, macOS 27.2. The session had no project folder (scratch workspace).
Steps:
- Run
/insightsin a desktop Code tab session. - Click the
file:///…/.claude/usage-data/report-YYYY-MM-DD-HHMMSS.htmllink in the reply.
Result: the file pane shows "This file is outside this session's folders — It can't be opened here, but it may still exist on disk." The message wording has changed since this issue was filed, but the behaviour is the same.
Cause: the /insights prompt makes the model reply with exactly the file:// line. That fits a terminal, where the link goes to the OS default browser. The desktop app sends file links to its file pane instead, and that pane only opens files inside the session's folders. ~/.claude/usage-data/ is never one of those. The OS side is fine here: macOS opens the report in Safari when it gets the link.
Workaround: open ~/.claude/usage-data/report-*.html
Fix 3 in the original report (open the report in the system browser when running in the desktop app) would cover this, and so would letting the pane open files under ~/.claude/usage-data/.