[BUG] /insights generates invalid file:// URL on Windows with non-ASCII username

Status Fixed / completed
Reported on v2.1.168
Maintainer reply None cached
Activity 3 comments · opened Jun 8, 2026 · closed Jun 8, 2026

Summary

The /insights command outputs a file:// URL that is not RFC 8089 compliant on Windows, making the link non-functional — especially when the Windows username contains non-ASCII characters (accented letters, etc.).

Environment

  • OS: Windows 11 Pro 10.0.22631
  • Claude Code version: 2.1.168
  • Username: Contains non-ASCII characters (e.g. accented letters like é U+00E9 and Í U+00CD)
  • USERPROFILE: C:\Users\[username-with-accents]

Current (broken) output

Report URL: file://C:\Users\[username-with-accents]\.claude\usage-data\report-2026-06-08-062656.html

Expected output

file:///C:/Users/[username-with-accents-percent-encoded]/.claude/usage-data/report-2026-06-08-062656.html

Root cause (test evidence)

The URL is constructed by manually concatenating "file://" + windowsPath instead of using Node.js's url.pathToFileURL().

Test results:

| Check | Result |
|---|---|
| Slashes | file:// (2) → should be file:/// (3) |
| Path separator | Windows \ → should be / |
| Non-ASCII encoding | Raw accented chars → should be percent-encoded (e.g. %C3%A9) |
| Node.js url.pathToFileURL() output | ✅ file:///C:/Users/[encoded-username]/.claude/... |
| Browser host interpretation | The current URL causes C:\Users\[username] to be treated as the hostname, making the link dead |

Node.js validation:

const { pathToFileURL } = require('url');
pathToFileURL('C:\Users\[username-with-accents]\.claude\usage-data\report.html').href
// => "file:///C:/Users/[percent-encoded-username]/.claude/usage-data/report.html"

Impact

Affects any Windows user whose USERPROFILE path contains:

  • Non-ASCII/accented characters in the username (common for Brazilian, French, Spanish, Portuguese, Eastern European users)
  • The clickable file:// link in the terminal is broken — users cannot open the HTML report directly

Suggested fix

Replace the manual "file://" + reportPath string construction with:

import { pathToFileURL } from 'url';
const reportUrl = pathToFileURL(reportPath).href;

Related issues

  • #26946 — Bash tool fails when username contains a single quote
  • #29538 — Permission denied when username contains a space
  • #24366 — Crash with Unicode emoji in username

These are part of a pattern of Windows non-ASCII username handling issues.

View original on GitHub ↗

3 Comments

wpraiz · 4 months ago

Closing to reopen without personal data in history.

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/66222
  2. https://github.com/anthropics/claude-code/issues/16729
  3. https://github.com/anthropics/claude-code/issues/17643

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] · 2 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.