CoplayDev/unity-mcp · error · ArgumentException

The selected Claude CLI executable does not exist

Error message

The selected Claude CLI executable does not exist

What it means

Thrown by PathResolverService.SetClaudeCliPathOverride when the given path does not exist as a file. The Claude CLI executable override is stored in EditorPrefs only after confirming it exists on disk. An empty path clears the override and does not throw.

Source

Thrown at MCPForUnity/Editor/Services/PathResolverService.cs:158

            if (!File.Exists(path))
            {
                throw new ArgumentException("The selected uvx executable does not exist");
            }

            EditorPrefs.SetString(EditorPrefKeys.UvxPathOverride, path);
        }

        public void SetClaudeCliPathOverride(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                ClearClaudeCliPathOverride();
                return;
            }

            if (!File.Exists(path))
            {
                throw new ArgumentException("The selected Claude CLI executable does not exist");
            }

            EditorPrefs.SetString(EditorPrefKeys.ClaudeCliPathOverride, path);
        }

        public void ClearUvxPathOverride()
        {
            EditorPrefs.DeleteKey(EditorPrefKeys.UvxPathOverride);
        }

        public void ClearClaudeCliPathOverride()
        {
            EditorPrefs.DeleteKey(EditorPrefKeys.ClaudeCliPathOverride);
        }

        /// <summary>
        /// Validates the provided uv executable by running "--version" and parsing the output.
        /// </summary>

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Locate the real claude binary ('which claude' / 'where claude').
  2. Pass the full absolute path to the executable.
  3. If unsure, clear the override (empty) and rely on auto-detection.

Example fix

// before
resolver.SetClaudeCliPathOverride(typedPath); // throws if file missing

// after
if (!string.IsNullOrEmpty(typedPath) && File.Exists(typedPath))
    resolver.SetClaudeCliPathOverride(typedPath);
else
    resolver.ClearClaudeCliPathOverride();
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(path)) { resolver.ClearClaudeCliPathOverride(); return; }
if (!File.Exists(path)) return ErrorResponse($"Claude CLI not found: {path}");
resolver.SetClaudeCliPathOverride(path);

Type guard

static bool IsExistingExecutable(string p) => !string.IsNullOrEmpty(p) && File.Exists(p);

Try / catch

try { resolver.SetClaudeCliPathOverride(path); }
catch (ArgumentException ex) when (ex.Message.Contains("Claude CLI"))
{ /* locate the real claude binary; or clear override to use auto-detection */ }

Prevention

When it happens

Trigger: User picked a Claude CLI path that is stale, a directory, or a typo; the Claude CLI was uninstalled/moved; a bare name passed instead of a full path.

Common situations: Claude CLI installed via npm in a relocated node folder; user typed 'claude' instead of the full path; uninstall after selection.

Related errors


AI-assisted analysis of CoplayDev/unity-mcp@c21bf496bc (2026-08-13). Data as JSON: /api/errors/05345ac2c47dc08b. Report an issue: GitHub.