Skip to content

Windows: Server fails to start when username contains spaces (EPIPE error) #2

Description

@DaniMughal371

Bug Description

The CodeGraph Language Server fails to start on Windows when the
username contains spaces. The server binary path is not quoted,
causing Windows to split the path at the space.

Environment

  • OS: Windows 11
  • VS Code Version: (your version)
  • CodeGraph Extension Version: 0.14.0
  • Username path: C:\Users\Muhammad Daniyal\

Error Message

From the CodeGraph Language Server output panel:

'c:\Users\Muhammad' is not recognized as an internal or external command,
operable program or batch file.

[Error] Client CodeGraph Language Server: connection to server is erroring.
write EPIPE
[Error] Server initialization failed.
Message: write EPIPE
Code: -32099
[Error] The CodeGraph Language Server server crashed 5 times in the last
3 minutes. The server will not be restarted.

Root Cause

In extension.js, the function S_() resolves the binary path using
r.asAbsolutePath() which returns:

C:\Users\Muhammad Daniyal.vscode\extensions\astudioplus.codegraph-0.14.0\bin\codegraph-server-win32-x64.exe

When this path is passed to the shell without quotes, Windows treats
Muhammad as the command and Daniyal\... as a separate argument,
causing the EPIPE crash.

Proof

The binary works perfectly when called with quotes:

& "C:\Users\Muhammad Daniyal.vscode\extensions\astudioplus.codegraph-0.14.0\bin\codegraph-server-win32-x64.exe" --version
// Output: codegraph-server 0.14.0

Suggested Fix

In the server launch configuration, ensure the binary path is quoted:

// Current (broken)
command: a // unquoted path with spaces

// Fixed
command: "${a}" // quoted path

OR set shell: true with proper escaping:
options: { shell: true }
// and ensure the command string wraps the path in quotes

Impact

This affects ALL Windows users whose username contains a space,
which is extremely common (e.g. "John Doe", "Muhammad Daniyal").
The extension is completely non-functional for these users.

Workarounds Attempted

  • codegraph.serverPath setting — ignored by extension
  • Directory junction to no-space path — Windows resolves
    real path through junction, same error
  • --extensions-dir flag — ignored by extension
    None of these work because the path is hardcoded via
    r.asAbsolutePath() internally.

Activity

  1. anvanster commented on May 22, 2026

    @anvanster
    Member

    Confirmed the root cause and shipped a fix in 0.16.2 (released today).

    shell: true on Windows routes the binary path through cmd.exe, which splits on the unquoted space in C:\Users\Muhammad Daniyal\.... The fix wraps the path in double quotes when on Windows:

    const command = isWindows ? `"${serverModule}"` : serverModule;
    const serverOptions: ServerOptions = {
        command,
        args: [],
        transport: TransportKind.stdio,
        options: { shell: isWindows, cwd: context.extensionPath },
    };

    VS Code Marketplace publish is in flight — once 0.16.2 lands (usually 15-30 minutes after marketplace acceptance), VS Code should auto-update on the next restart. If you want to verify before then, download the VSIX directly from the GitHub release and install via "Install from VSIX..." in the Extensions panel.

    Thanks for the very clean bug report — the repro, the root cause, and a working PoC in one issue is exactly what made this a 5-minute fix. Closing once the marketplace publish is confirmed.

  2. anvanster commented on May 22, 2026

    @anvanster
    Member

    0.16.3 is now live on the VS Code Marketplace and npm.

    VS Code extension: https://marketplace.visualstudio.com/items?itemName=aStudioPlus.codegraph
    npm: npm install -g @astudioplus/codegraph-mcp@0.16.3

    The Windows path-quoting fix shipped in 0.16.2 (commit 932ad0b) and is included in 0.16.3.

    VS Code should auto-update on the next window reload. If you want to confirm immediately, check the "CodeGraph" output channel — the Language Server start should succeed and you should not see the EPIPE error.

    Thanks again for the precise repro and the clear root-cause analysis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions