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

Resolved 💬 3 comments Opened Jun 8, 2026 by wpraiz Closed Jul 14, 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.html

Expected output

file:///C:/Users/[username-percent-encoded]/.claude/usage-data/report.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\[accented-username]\.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 — common for Brazilian, French, Spanish, Portuguese, Eastern European users. The clickable file:// link in the terminal is broken and 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗