claude-code - 💡(How to fix) Fix DXT ${__dirname} resolves to MSIX-virtualized path, breaking external process spawns [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#47977Fetched 2026-04-15 06:36:55
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1

When Claude Desktop is installed as an MSIX package on Windows, DXT extensions that spawn external processes (e.g. py.exe for Python MCP servers) fail because ${__dirname} resolves to a path inside the MSIX virtual filesystem that external processes cannot see.

Root Cause

MSIX filesystem virtualization redirects AppData\Roaming\ writes to AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\. Claude Desktop (inside the sandbox) resolves ${__dirname} to the virtual path (AppData\Roaming\...), but the spawned external process (py.exe) runs outside the MSIX sandbox and cannot see files at that path.

Per Microsoft's MSIX docs, on Windows 10 1903+:

  • Newly created files/folders in AppData are written to the per-app virtualized location
  • Child processes spawned by MSIX apps do not inherit the package context
  • Command-line argument paths are not automatically rewritten from virtual to real paths

This only affects fresh installations where Claude Extensions\ didn't previously exist at the real AppData\Roaming\ path. Machines with a pre-existing folder (from an earlier non-MSIX install) are unaffected because MSIX writes to pre-existing real paths.

Fix Action

Workaround

Manually create the real directory before installing the extension, so MSIX doesn't virtualize it:

New-Item -ItemType Directory -Path "$env:APPDATA\Claude\Claude Extensions" -Force

Then reinstall the .mcpb extension.

Code Example

"server": {
     "type": "python",
     "entry_point": "server.py",
     "mcp_config": {
       "command": "py",
       "args": ["${__dirname}/server.py"]
     }
   }

---

C:\Program Files\Python312\python.exe: can't open file
'C:\Users\<user>\AppData\Roaming\Claude\Claude Extensions\<extension-id>/server.py':
[Errno 2] No such file or directory

---

C:\Users\<user>\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\Claude Extensions\<extension-id>\server.py

---

New-Item -ItemType Directory -Path "$env:APPDATA\Claude\Claude Extensions" -Force
RAW_BUFFERClick to expand / collapse

Summary

When Claude Desktop is installed as an MSIX package on Windows, DXT extensions that spawn external processes (e.g. py.exe for Python MCP servers) fail because ${__dirname} resolves to a path inside the MSIX virtual filesystem that external processes cannot see.

Environment

  • Windows 11 Pro
  • Claude Desktop (MSIX-packaged, Claude_pzs8sxrjxfjjc)
  • DXT extension with type: "python" using ${__dirname} in mcp_config.args

Steps to Reproduce

  1. Install Claude Desktop on a fresh Windows machine (no prior Claude Desktop installation)
  2. Install a DXT extension (.mcpb) that uses a Python MCP server with this manifest:
    "server": {
      "type": "python",
      "entry_point": "server.py",
      "mcp_config": {
        "command": "py",
        "args": ["${__dirname}/server.py"]
      }
    }
  3. Claude Desktop extracts the bundle and spawns py.exe with the resolved ${__dirname} path

Expected Behavior

py.exe finds and runs server.py at the path provided by ${__dirname}.

Actual Behavior

C:\Program Files\Python312\python.exe: can't open file
'C:\Users\<user>\AppData\Roaming\Claude\Claude Extensions\<extension-id>/server.py':
[Errno 2] No such file or directory

The file actually exists at the MSIX-virtualized path:

C:\Users\<user>\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\Claude Extensions\<extension-id>\server.py

Root Cause

MSIX filesystem virtualization redirects AppData\Roaming\ writes to AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\. Claude Desktop (inside the sandbox) resolves ${__dirname} to the virtual path (AppData\Roaming\...), but the spawned external process (py.exe) runs outside the MSIX sandbox and cannot see files at that path.

Per Microsoft's MSIX docs, on Windows 10 1903+:

  • Newly created files/folders in AppData are written to the per-app virtualized location
  • Child processes spawned by MSIX apps do not inherit the package context
  • Command-line argument paths are not automatically rewritten from virtual to real paths

This only affects fresh installations where Claude Extensions\ didn't previously exist at the real AppData\Roaming\ path. Machines with a pre-existing folder (from an earlier non-MSIX install) are unaffected because MSIX writes to pre-existing real paths.

Workaround

Manually create the real directory before installing the extension, so MSIX doesn't virtualize it:

New-Item -ItemType Directory -Path "$env:APPDATA\Claude\Claude Extensions" -Force

Then reinstall the .mcpb extension.

Suggested Fix

When resolving ${__dirname}, Claude Desktop should detect MSIX packaging and resolve to the real filesystem path (AppData\Local\Packages\...\LocalCache\Roaming\...) rather than the virtual path, since spawned child processes run outside the sandbox.

Alternatively, Claude Desktop could write extensions to a non-AppData location (MSIX only virtualizes AppData paths), or declare unvirtualizedResources / FilesystemWriteVirtualization=disabled in its MSIX manifest for the extensions directory.

Related Issues

  • #25579 — MSIX virtualization redirects app.getPath("userData"); documents the core path mismatch
  • #26073 — "Edit Config" opens wrong claude_desktop_config.json due to MSIX path
  • #29302 — Windows-MCP extension fails because executable in MSIX virtualized path is blocked
  • #35037 — MSIX causes rename() EXDEV errors crossing virtual/real boundary

extent analysis

TL;DR

To fix the issue, Claude Desktop should resolve ${__dirname} to the real filesystem path instead of the virtual path when running in an MSIX package.

Guidance

  • Detect MSIX packaging and adjust the path resolution for ${__dirname} to use the real filesystem path (AppData\Local\Packages\...\LocalCache\Roaming\...) instead of the virtual path.
  • As a workaround, manually create the real directory before installing the extension using the provided PowerShell command to prevent MSIX from virtualizing it.
  • Consider writing extensions to a non-AppData location or declaring unvirtualizedResources / FilesystemWriteVirtualization=disabled in the MSIX manifest for the extensions directory as alternative solutions.
  • Verify the fix by checking if the spawned external process (py.exe) can access the file at the resolved path.

Example

New-Item -ItemType Directory -Path "$env:APPDATA\Claude\Claude Extensions" -Force

This command creates the real directory, allowing MSIX to write to the pre-existing path instead of virtualizing it.

Notes

The issue only affects fresh installations of Claude Desktop as an MSIX package on Windows, where the Claude Extensions directory does not previously exist at the real AppData\Roaming path.

Recommendation

Apply the workaround by manually creating the real directory before installing the extension, as this provides a immediate solution to the issue. A more permanent fix would involve modifying Claude Desktop to resolve ${__dirname} to the real filesystem path when running in an MSIX package.

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