langflow-ai/langflow · error · ValueError

Could not determine Windows Claude config path in WSL: {e!s}

Error message

Could not determine Windows Claude config path in WSL: {e!s}

What it means

Raised by get_config_path() in Langflow's MCP projects API when the WSL code path for the Claude client hits an OSError or CalledProcessError while probing the Windows host. The probe launches /mnt/c/Windows/System32/cmd.exe /c "echo %USERNAME%" to learn the Windows username; if the executable cannot be spawned or fails, the exception is chained into this ValueError with the underlying message. A warning is also logged via logger.awarning before the raise.

Source

Thrown at src/backend/base/langflow/api/v1/mcp_projects.py:1283

                        # Get the first non-system user directory
                        user_dirs = [
                            d
                            for d in users_dir.iterdir()
                            if d.is_dir() and not d.name.startswith(("Default", "Public", "All Users"))
                        ]
                        if user_dirs:
                            return user_dirs[0] / "AppData" / "Roaming" / "Claude" / "claude_desktop_config.json"

                    if not Path("/mnt/c").exists():
                        msg = "Windows C: drive not mounted at /mnt/c in WSL"
                        raise ValueError(msg)

                    msg = "Could not find valid Windows user directory in WSL"
                    raise ValueError(msg)
                except (OSError, CalledProcessError) as e:
                    await logger.awarning("Failed to determine Windows user path in WSL: %s", str(e))
                    msg = f"Could not determine Windows Claude config path in WSL: {e!s}"
                    raise ValueError(msg) from e
            # Regular Windows
            return Path(os.environ["APPDATA"]) / "Claude" / "claude_desktop_config.json"

        msg = "Unsupported operating system for Claude configuration"
        raise ValueError(msg)

    msg = "Unsupported client"
    raise ValueError(msg)


def remove_server_by_urls(config_data: dict, urls: Sequence[str] | str) -> tuple[dict, list[str]]:
    """Remove any MCP servers that use one of the specified URLs from config data.

    Returns:
        tuple: (updated_config, list_of_removed_server_names)
    """
    normalized_urls = _normalize_url_list(urls)
    if not normalized_urls:

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Confirm cmd.exe is reachable: ls /mnt/c/Windows/System32/cmd.exe. If missing, remount the Windows drive (sudo mount -t drvfs C: /mnt/c) or fix /etc/wsl.conf [automount].
  2. Re-enable WSL interop if disabled: ensure /etc/wsl.conf contains [interop] enabled=true, then run wsl --shutdown from Windows and restart the distro.
  3. Check the logged warning ('Failed to determine Windows user path in WSL: ...') for the exact OSError errno/exit code — EACCES points to drvfs permission/metadata issues, ENOENT to a wrong mount path.
  4. If you cannot enable interop, run Langflow on native Windows (where APPDATA is used directly) or configure the client on the Linux side manually.

Example fix

# before: single fragile probe of cmd.exe
proc = await create_subprocess_exec(
    "/mnt/c/Windows/System32/cmd.exe", "/c", "echo %USERNAME%", ...
)

# after: probe cmd.exe but let the /mnt/c/Users directory scan recover
# (already present as fallback in this code); additionally guard spawn:
cmd = "/mnt/c/Windows/System32/cmd.exe"
if not Path(cmd).exists():
    # skip subprocess, go straight to the /mnt/c/Users scan
    pass
Defensive patterns

Strategy: fallback

Validate before calling

from pathlib import Path

def wsl_cmd_probe_possible() -> bool:
    """True when the cmd.exe username probe can run."""
    return Path("/mnt/c/Windows/System32/cmd.exe").exists()

Try / catch

try:
    path = await get_config_path("claude")
except (OSError, ValueError) as e:
    # ValueError with 'Could not determine Windows Claude config path' chains an OSError/CalledProcessError;
    # both the primary probe and the /mnt/c/Users fallback failed -> degrade gracefully
    log.warning("Claude config path unavailable in WSL: %s", e)
    path = None  # skip Claude client actions instead of failing the whole request

Prevention

When it happens

Trigger: Calling get_config_path("claude") under WSL when /mnt/c/Windows/System32/cmd.exe is missing (drive not mounted at /mnt/c, different Windows language/layout path), when WSL interop is disabled (wsl.conf [interop] enabled=false or appendWindowsPath=false with a broken spawn), when NTFS permissions or drvfs metadata block execute on cmd.exe, or when the subprocess exits non-zero (CalledProcessError path).

Common situations: Hardened or minimal WSL2 distros with Windows interop deliberately disabled; WSL instances where Windows is mounted somewhere other than /mnt/c; running Langflow inside a container on WSL that cannot see the host's Windows binaries; corporate policies that restrict executing Windows binaries from WSL.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/66c74a02859a02b4. Report an issue: GitHub.