{"record":{"id":"49d5f00fd59393fb","repo":"CoplayDev/unity-mcp","slug":"no-detector-available-for-current-platform-runti","errorCode":null,"errorMessage":"No detector available for current platform: {RuntimeInformation.OSDescription}","messagePattern":"No detector available for current platform: (.+?)","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"critical","filePath":"MCPForUnity/Editor/Dependencies/DependencyManager.cs","lineNumber":37,"sourceCode":"        {\n            new WindowsPlatformDetector(),\n            new MacOSPlatformDetector(),\n            new LinuxPlatformDetector()\n        };\n\n        private static IPlatformDetector _currentDetector;\n\n        /// <summary>\n        /// Get the platform detector for the current operating system\n        /// </summary>\n        public static IPlatformDetector GetCurrentPlatformDetector()\n        {\n            if (_currentDetector == null)\n            {\n                _currentDetector = _detectors.FirstOrDefault(d => d.CanDetect);\n                if (_currentDetector == null)\n                {\n                    throw new PlatformNotSupportedException($\"No detector available for current platform: {RuntimeInformation.OSDescription}\");\n                }\n            }\n            return _currentDetector;\n        }\n\n        /// <summary>\n        /// Perform a comprehensive dependency check\n        /// </summary>\n        public static DependencyCheckResult CheckAllDependencies()\n        {\n            var result = new DependencyCheckResult();\n\n            try\n            {\n                var detector = GetCurrentPlatformDetector();\n                McpLog.Info($\"Checking dependencies on {detector.PlatformName}...\", always: false);\n\n                // Check Python","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Dependencies/DependencyManager.cs#L19-L55","documentation":"DependencyManager.GetCurrentPlatformDetector() iterates a fixed list of three detectors (Windows, MacOS, Linux) and picks the first whose CanDetect returns true. If none match, it throws PlatformNotSupportedException. This is a hard guard for unsupported operating systems — the dependency check subsystem cannot detect Python/uv on an unknown platform.","triggerScenarios":"Running the Unity Editor on a platform that is not Windows, macOS, or Linux (e.g., FreeBSD, a custom OS), or where RuntimeInformation.OSDescription does not match any detector's platform check.","commonSituations":"Unity running under WSLg or an unusual Linux distro where the OS detection string is unexpected. A community port of Unity to a non-standard platform. Running in a container where OS platform detection returns ambiguous results.","solutions":["Run Unity on a supported OS (Windows, macOS, or a standard Linux distribution).","If on an unusual platform, implement a custom IPlatformDetector and insert it into the _detectors list before calling GetCurrentPlatformDetector().","Check RuntimeInformation.OSDescription output to understand why no detector matched.","Wrap the call in try-catch(PlatformNotSupportedException) and provide a fallback that bypasses dependency detection."],"exampleFix":"// before\nvar detector = DependencyManager.GetCurrentPlatformDetector();\n\n// after\nIPlatformDetector detector;\ntry { detector = DependencyManager.GetCurrentPlatformDetector(); }\ncatch (PlatformNotSupportedException ex)\n{\n    McpLog.Warn($\"Unsupported platform, skipping dependency check: {ex.Message}\");\n    return;\n}","handlingStrategy":"try-catch","validationCode":"if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&\n    !RuntimeInformation.IsOSPlatform(OSPlatform.OSX) &&\n    !RuntimeInformation.IsOSPlatform(OSPlatform.Linux))\n{ /* unsupported platform; skip dependency check */ }","typeGuard":"public static bool IsPlatformSupported() =>\n    RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||\n    RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ||\n    RuntimeInformation.IsOSPlatform(OSPlatform.Linux);","tryCatchPattern":"try { var detector = DependencyManager.GetCurrentPlatformDetector(); }\ncatch (PlatformNotSupportedException ex)\n{ Debug.LogWarning($\"Unsupported platform for dependency detection: {ex.Message}\"); }","preventionTips":["Run Unity on Windows, macOS, or a standard Linux distribution.","If extending to a new platform, implement IPlatformDetector and add it to the detectors list.","Guard all DependencyManager calls with IsPlatformSupported() in non-standard environments."],"tags":["platform","dependency","unsupported-os","runtime"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}