{"record":{"id":"430f0725d3e7fb48","repo":"CoplayDev/unity-mcp","slug":"install-dir-resolved-to-an-empty-path","errorCode":null,"errorMessage":"Install Dir resolved to an empty path.","messagePattern":"Install Dir resolved to an empty path\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Setup/SkillSyncService.cs","lineNumber":688,"sourceCode":"            var trimmed = installDir.Trim();\n            if (trimmed.IndexOfAny(Path.GetInvalidPathChars()) >= 0)\n            {\n                throw new InvalidOperationException($\"Install Dir contains invalid path characters: {installDir}\");\n            }\n\n            string expandedPath;\n            try\n            {\n                expandedPath = ExpandPath(trimmed);\n            }\n            catch (Exception ex)\n            {\n                throw new InvalidOperationException($\"Install Dir is invalid and cannot be resolved: {installDir}\", ex);\n            }\n\n            if (string.IsNullOrWhiteSpace(expandedPath))\n            {\n                throw new InvalidOperationException(\"Install Dir resolved to an empty path.\");\n            }\n\n            return expandedPath;\n        }\n\n        internal static string ExpandPath(string path)\n        {\n            if (string.IsNullOrWhiteSpace(path))\n            {\n                return string.Empty;\n            }\n\n            var expanded = path.Trim();\n            if (expanded.StartsWith(\"~\", StringComparison.Ordinal))\n            {\n                var userHome = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);\n                expanded = Path.Combine(userHome, expanded.Substring(1).TrimStart('/', '\\\\'));\n            }","sourceCodeStart":670,"sourceCodeEnd":706,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Setup/SkillSyncService.cs#L670-L706","documentation":"After ExpandPath returns, if the result is null/empty/whitespace the sync cannot proceed. This guards the rare case where expansion (e.g. '~' resolved via Environment.GetFolderPath) yields an empty string.","triggerScenarios":"A tilde path on a headless/container environment where Environment.GetFolderPath(UserProfile) returns empty; an edge case in Path.GetFullPath producing whitespace.","commonSituations":"Running inside a minimal container or service account with no user profile; CI agent without a home directory.","solutions":["Provide an absolute path instead of relying on '~' expansion.","Ensure the process has a valid user profile/home directory.","Set an explicit install directory in Advanced Settings."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var expanded = SkillSyncService.ExpandPath(installDir);\nif (string.IsNullOrWhiteSpace(expanded))\n{\n    throw new ArgumentException(\"Install dir resolved to empty. Provide an absolute path.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer absolute paths over '~' in headless/container environments.","Ensure the process runs with a valid user profile/home directory.","Set an explicit install directory in Advanced Settings."],"tags":["config","path","edge-case"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}