Skip to content

thv llm setup always fails on Windows: "shell-unsafe characters" in executable path #6325

Description

@jerm-dro

Problem

thv llm setup fails on every Windows machine when a direct-mode tool (Claude Code) or Claude Desktop is detected:

Error: executable path "C:\Users\crux\AppData\Local\Microsoft\WinGet\Packages\stacklok.thv_Microsoft.Winget.Source_8wekyb3d8bbwe\thv.exe" contains shell-unsafe characters; move thv to a path without quotes, backslashes, semicolons, dollar signs, or backticks (Windows paths are not supported by thv llm setup)

Reported by a user who installed via WinGet.

Cause

buildTokenHelperCommand in pkg/llm/setup.go interpolates os.Executable() into a shell command string ("<path>" llm token) that is written into Claude Code's apiKeyHelper. Because that string is later re-executed by a shell, the function rejects paths containing shell metacharacters — including \.

Backslash is the Windows path separator, so no Windows path can pass. WinGet is incidental: C:\thv.exe fails identically. The remediation the error suggests ("move thv to a path without backslashes") is impossible to follow on Windows.

Two things make it worse than a single-tool failure:

  • The check runs before login and before any file is patched, so setup aborts entirely.
  • It is gated on whether any detected tool needs the shell helper, so an installed Claude Code fails the whole run — including proxy-mode tools like Cursor that never use the string.

Impact

thv llm setup is unusable on Windows for Claude Code and Claude Desktop. Codex is unaffected (it uses an argv table with no shell). Proxy-mode tools are only affected via the shared-abort behaviour above.

Workaround

Configure Claude Code by hand — thv llm config set has no such restriction, then add apiKeyHelper / ANTHROPIC_BASE_URL / CLAUDE_CODE_API_KEY_HELPER_TTL_MS to %USERPROFILE%\.claude\settings.json manually, using a bare thv llm token rather than an absolute path.

Note

Claude Desktop is separately blocked on Windows (its credential-helper shim is a POSIX /bin/sh script) and needs its own fix.

Activity

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

    needs-triageIssue needs initial triage by a maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions