{"record":{"id":"fbdffca0afb7224a","repo":"CoplayDev/unity-mcp","slug":"install-dir-is-empty","errorCode":null,"errorMessage":"Install Dir is empty.","messagePattern":"Install Dir is empty\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Setup/SkillSyncService.cs","lineNumber":667,"sourceCode":"\n            var directories = Directory.GetDirectories(root, \"*\", SearchOption.AllDirectories);\n            Array.Sort(directories, (a, b) => string.CompareOrdinal(b, a));\n            foreach (var directory in directories)\n            {\n                if (Directory.EnumerateFileSystemEntries(directory).Any())\n                {\n                    continue;\n                }\n\n                Directory.Delete(directory, false);\n            }\n        }\n\n        internal static string ResolveAndValidateInstallPath(string installDir)\n        {\n            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","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Setup/SkillSyncService.cs#L649-L685","documentation":"ResolveAndValidateInstallPath throws when installDir is null or whitespace. The sync needs a concrete target directory before it can create, validate, or write anything.","triggerScenarios":"The install-directory UI field was left blank; a serialized/EditorPrefs setting resolved to empty; a programmatic caller passed null.","commonSituations":"First-run with no default set; setting cleared by a reset; caller forgot to pass the path.","solutions":["Provide a non-empty install directory path.","Set a default in Advanced Settings so the field is never blank.","If calling programmatically, guard against null before invoking SyncAsync."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(installDir))\n{\n    throw new ArgumentException(\"Install directory must not be empty.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set a sensible default install directory in Advanced Settings.","Validate the field is non-empty in the UI before enabling the sync button.","Guard programmatic callers against null."],"tags":["config","validation","path"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}