CoplayDev/unity-mcp · error · InvalidOperationException

Remote directory not found: {normalizedSubdir}

Error message

Remote directory not found: {normalizedSubdir}

What it means

After filtering the full tree by the skill subdir prefix, zero blob entries remained. The configured SkillSubdir (.claude/skills/unity-mcp-skill) does not exist at the fetched commit, so there is nothing to sync.

Source

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

                    ? remotePath
                    : remotePath.Substring(subdirPrefix.Length);
                if (string.IsNullOrWhiteSpace(relativePath) || string.IsNullOrWhiteSpace(entry.sha))
                {
                    continue;
                }

                if (!TryNormalizeRelativePath(relativePath, out var safeRelativePath))
                {
                    log?.Invoke($"Skip unsafe remote path: {remotePath}");
                    continue;
                }

                remoteFiles[safeRelativePath] = entry.sha.Trim().ToLowerInvariant();
            }

            if (remoteFiles.Count == 0)
            {
                throw new InvalidOperationException($"Remote directory not found: {normalizedSubdir}");
            }

            log?.Invoke($"Remote file count: {remoteFiles.Count}");
            return new RemoteSnapshot(commitSha, normalizedSubdir, remoteFiles);
        }

        private static string FetchBranchHeadCommitSha(HttpClient client, GitHubRepoInfo repoInfo, string branch, Action<string> log)
        {
            var branchApiUrl = BuildBranchApiUrl(repoInfo, branch);
            log?.Invoke($"Fetching branch head commit...");
            var branchJson = DownloadString(client, branchApiUrl);
            var branchResponse = JsonUtility.FromJson<GitHubBranchResponse>(branchJson);
            var commitSha = branchResponse?.commit?.sha?.Trim();
            if (string.IsNullOrWhiteSpace(commitSha))
            {
                throw new InvalidOperationException($"Failed to resolve branch head commit SHA for: {branch}");
            }

View on GitHub (pinned to c21bf496bc)

Solutions

  1. Confirm the directory exists in the repo at the target branch via the GitHub UI.
  2. Switch to a branch that contains the skill files (main or beta).
  3. If the directory was renamed upstream, update to the latest version of the package.
  4. Use the default repo (CoplayDev/unity-mcp) which is known to contain the directory.
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: The branch does not contain the skill directory; the directory was renamed or moved; the wrong branch was selected; a fork removed the skill files.

Common situations: Syncing against a branch that predates the skill directory; fork reorganized the repo layout; typo in the configured subdir (hardcoded constant).

Related errors


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