CoplayDev/unity-mcp · error · InvalidOperationException

Repo URL is not a recognized GitHub repository URL: {repoUrl

Error message

Repo URL is not a recognized GitHub repository URL: {repoUrl}

What it means

TryParseGitHubRepository only accepts github.com absolute URLs (any scheme) or git@github.com: SSH URLs that contain at least owner/repo segments. RunSync throws this when the configured repo URL does not match either shape, so the sync never contacts the API.

Source

Thrown at MCPForUnity/Editor/Setup/SkillSyncService.cs:71

                    };
                }
                catch (Exception ex)
                {
                    EditorApplication.delayCall += () =>
                    {
                        onComplete?.Invoke(new SyncResult { Success = false, Error = ex.Message });
                    };
                }
            });
        }

        private static SyncResult RunSync(string repoUrl, string installDir, string branch, string lastSyncedCommit, Action<string> log)
        {
            log?.Invoke("=== Sync Start ===");

            if (!TryParseGitHubRepository(repoUrl, out var repoInfo))
            {
                throw new InvalidOperationException($"Repo URL is not a recognized GitHub repository URL: {repoUrl}");
            }

            log?.Invoke($"Target repository: {repoInfo.Owner}/{repoInfo.Repo}@{branch}");
            var snapshot = FetchRemoteSnapshot(repoInfo, branch, SkillSubdir, log);
            var installPath = ResolveAndValidateInstallPath(installDir);

            if (!Directory.Exists(installPath))
            {
                Directory.CreateDirectory(installPath);
            }

            var localFiles = ListFiles(installPath);
            var pathComparison = GetPathComparison(installPath);
            var pathComparer = GetPathComparer(pathComparison);
            EnsureManagedInstallRoot(installPath, localFiles.Keys, snapshot.Files.Keys, pathComparer);
            var plan = BuildPlan(snapshot.Files, localFiles, pathComparer);
            var commitChanged = !string.Equals(lastSyncedCommit, snapshot.CommitSha, StringComparison.Ordinal);

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Use a github.com URL in the form 'https://github.com/<owner>/<repo>'.
  2. For SSH-style input use 'git@github.com:<owner>/<repo>'.
  3. Ensure the URL has a scheme (http/https) so it parses as absolute.
  4. Leave repoUrl at the default (CoplayDev/unity-mcp) unless you intentionally fork.

Example fix

// before
var repoUrl = "gitlab.com/me/unity-mcp";
// after
var repoUrl = "https://github.com/CoplayDev/unity-mcp";
Defensive patterns

Strategy: validation

Validate before calling

if (!SkillSyncService.TryParseGitHubRepository(repoUrl, out _))
{
    throw new ArgumentException($"Repo URL must be a github.com URL like https://github.com/<owner>/<repo>: {repoUrl}");
}

Prevention

When it happens

Trigger: repoUrl points at a non-GitHub host (GitLab, Bitbucket, Gitea); URL is relative or non-absolute so Uri.TryCreate fails; path has fewer than two segments ('github.com/owner'); URL is empty/whitespace.

Common situations: User forked the skill repo to a different host; copied a file-browser URL with no owner/repo; pasted a raw URL fragment; entered a local filesystem path.

Related errors


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