{"record":{"id":"d6270db690dfeb38","repo":"CoplayDev/unity-mcp","slug":"install-dir-is-invalid-and-cannot-be-resolved-in","errorCode":null,"errorMessage":"Install Dir is invalid and cannot be resolved: {installDir}","messagePattern":"Install Dir is invalid and cannot be resolved: (.+?)","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Setup/SkillSyncService.cs","lineNumber":683,"sourceCode":"            if (string.IsNullOrWhiteSpace(installDir))\n            {\n                throw new InvalidOperationException(\"Install Dir is empty.\");\n            }\n\n            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();","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Setup/SkillSyncService.cs#L665-L701","documentation":"ExpandPath performs tilde expansion then Path.GetFullPath; if that throws (path too long, security exception, unreachable root, malformed), ResolveAndValidateInstallPath wraps it in this message with the original exception as inner.","triggerScenarios":"Path exceeds system length limits at GetFullPath; a SecurityException denies path resolution; the expanded path references a drive/root that cannot be resolved on the current platform.","commonSituations":"Very deep nested path on Windows; running under restricted permissions; mixing POSIX separators on a system that rejects them.","solutions":["Use a shorter absolute path.","Check folder and parent-directory permissions.","Avoid deeply nested or unusually structured paths.","Inspect the inner exception in the log for the specific GetFullPath failure."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"try { _ = Path.GetFullPath(installDir.Trim()); }\ncatch (Exception ex) { throw new ArgumentException(\"Install dir cannot be resolved.\", ex); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use short, absolute paths to avoid length/resolution failures.","Check permissions on the target and parent directories.","Inspect the inner exception for the specific GetFullPath cause."],"tags":["config","path","filesystem"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}