{"record":{"id":"9f71fd188230eb3d","repo":"CoplayDev/unity-mcp","slug":"install-dir-contains-invalid-path-characters-ins","errorCode":null,"errorMessage":"Install Dir contains invalid path characters: {installDir}","messagePattern":"Install Dir contains invalid path characters: (.+?)","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Setup/SkillSyncService.cs","lineNumber":673,"sourceCode":"                {\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\n            if (string.IsNullOrWhiteSpace(expandedPath))\n            {\n                throw new InvalidOperationException(\"Install Dir resolved to an empty path.\");\n            }\n\n            return expandedPath;","sourceCodeStart":655,"sourceCodeEnd":691,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Setup/SkillSyncService.cs#L655-L691","documentation":"ResolveAndValidateInstallPath checks the trimmed path against Path.GetInvalidPathChars() and throws if any illegal character (e.g. <, >, |, \", or control chars) is present. These characters cannot appear in a real filesystem path.","triggerScenarios":"User pasted a URL or a copy-paste artifact containing special characters; a template/variable was not substituted and left a literal like '<project>'; input mixed path separators with disallowed chars.","commonSituations":"Placeholder syntax left in the path; pasted from a rich-text source that inserted smart quotes; URL fragment mistaken for a path.","solutions":["Remove any of <, >, |, \", or control characters from the path.","Use a plain filesystem path with normal separators.","If using a template variable, ensure it is resolved before passing the value."],"exampleFix":"// before\nvar installDir = \"<project>/Skills\";\n// after\nvar installDir = \"/Users/me/Projects/MyGame/Skills\";","handlingStrategy":"validation","validationCode":"if (installDir.IndexOfAny(Path.GetInvalidPathChars()) >= 0)\n{\n    throw new ArgumentException($\"Install directory contains invalid characters: {installDir}\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Paste plain filesystem paths, not URLs or templates.","Resolve template variables before passing the value.","Avoid smart quotes and angle brackets from rich-text copy-paste."],"tags":["config","validation","path"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}