claude-code - 💡(How to fix) Fix [BUG] file:// URL in /insights output loses backslash before ".claude" when rendered [1 comments, 2 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#52282Fetched 2026-04-24 06:11:17
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

No stderr or exception — purely a rendering issue.

Minimal reproduction of rendered vs. actual:

Rendered: file://C:\Users\Gll.claude\usage-data\report.html Actual: C:\Users\Gll.claude\usage-data\report.html ^ backslash missing in render

Root Cause

  1. Use Claude Code on Windows (path containing \.claude — the default global config directory).
  2. In any project, run /insights.
  3. Wait for the report to generate.
  4. Observe the final message: Your shareable insights report is ready: file://C:\Users\<user>\.claude\usage-data\report.html
  5. Copy the rendered URL from the terminal and try to open it — it points to a non-existent path because the backslash before .claude was dropped during rendering.

Fix Action

Fix / Workaround

Workarounds I'm using locally:

  • In my own slash commands, I wrap Windows paths in backticks when reporting them, which preserves the backslash visually.
  • For clickable links, I emit URIs with forward slashes: file:///C:/Users/Gll/.claude/usage-data/report.html.

Code Example

No stderr or exception — purely a rendering issue.

Minimal reproduction of rendered vs. actual:

Rendered:  file://C:\Users\Gll.claude\usage-data\report.html
Actual:    C:\Users\Gll\.claude\usage-data\report.html
                         ^
                         backslash missing in render
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When /insights finishes, the response includes a link to the generated HTML report. The rendered output drops the backslash (\) immediately before .claude in the Windows path, producing a visually broken URL.

Observed output in terminal: Your shareable insights report is ready: file://C:\Users\Gll.claude\usage-data\report.html

Actual path on disk (correct): C:\Users\Gll.claude\usage-data\report.html

Note the missing backslash between Gll and .claude in the rendered URL. The file itself is created at the correct path — only the displayed link is wrong, which breaks click-to-open in terminals that linkify file:// URLs.

Likely cause: the renderer interprets \. in the markdown/ANSI output as an escape sequence and strips the backslash. Other Windows paths with \.something would presumably have the same issue.

What Should Happen?

The rendered file:// URL should preserve every backslash in the Windows path exactly as it exists on disk, so that:

  1. The link is visually correct (file://C:\Users\Gll\.claude\usage-data\report.html)
  2. Terminals that linkify file:// URLs can open the file directly without a 404

Possible fixes:

  • Escape backslashes before rendering (\\ instead of \)
  • Emit a file:/// URI with forward slashes (file:///C:/Users/Gll/.claude/usage-data/report.html) — this is the RFC 8089 form and sidesteps escape ambiguity
  • Wrap the path in backticks so it's rendered as inline code and not interpreted as markdown

Error Messages/Logs

No stderr or exception — purely a rendering issue.

Minimal reproduction of rendered vs. actual:

Rendered:  file://C:\Users\Gll.claude\usage-data\report.html
Actual:    C:\Users\Gll\.claude\usage-data\report.html
                         ^
                         backslash missing in render

Steps to Reproduce

  1. Use Claude Code on Windows (path containing \.claude — the default global config directory).
  2. In any project, run /insights.
  3. Wait for the report to generate.
  4. Observe the final message: Your shareable insights report is ready: file://C:\Users\<user>\.claude\usage-data\report.html
  5. Copy the rendered URL from the terminal and try to open it — it points to a non-existent path because the backslash before .claude was dropped during rendering.

Confirmed with:

  • OS: Windows 11
  • Shell: PowerShell 7 (pwsh)
  • Claude Code installed via Scoop shim (C:\Users\<user>\.local\bin\claude.EXE)

The same rendering issue likely affects any output that emits a Windows path containing a \. sequence in a markdown/ANSI context — not just /insights.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.118 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Workarounds I'm using locally:

  • In my own slash commands, I wrap Windows paths in backticks when reporting them, which preserves the backslash visually.
  • For clickable links, I emit URIs with forward slashes: file:///C:/Users/Gll/.claude/usage-data/report.html.

Scope guess: any renderer path that processes \. as an escape sequence will hit this. Other commands emitting Windows paths in prose (not in code blocks) probably have the same issue — e.g., /compact summaries, error messages, tool result summaries.

Not a regression as far as I know — I haven't tested older versions for this specific output.

extent analysis

TL;DR

The issue can be fixed by escaping backslashes in Windows paths or using the RFC 8089 form of the file:/// URI with forward slashes.

Guidance

  • The likely cause is the renderer interpreting \. as an escape sequence and stripping the backslash, so escaping backslashes (\\ instead of \) could resolve the issue.
  • Using the RFC 8089 form of the file:/// URI with forward slashes (file:///C:/Users/Gll/.claude/usage-data/report.html) is another potential fix.
  • Wrapping the path in backticks to render it as inline code could also preserve the backslash visually.
  • Testing with different rendering options or path formats can help verify which solution works best.

Example

No code snippet is provided as the issue is related to rendering and path formatting, but an example of using the RFC 8089 form could be: file:///C:/Users/Gll/.claude/usage-data/report.html.

Notes

The issue may not be limited to the /insights command and could affect any output that emits a Windows path containing a \. sequence in a markdown/ANSI context.

Recommendation

Apply the workaround of using the RFC 8089 form of the file:/// URI with forward slashes, as it sidesteps escape ambiguity and is a standardized format.

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