{"record":{"id":"c4e1b5bc9e677b8c","repo":"CoplayDev/unity-mcp","slug":"unknown-or-unsupported-command-type-commandname","errorCode":null,"errorMessage":"Unknown or unsupported command type: {commandName}","messagePattern":"Unknown or unsupported command type: (.+?)","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"MCPForUnity/Editor/Tools/CommandRegistry.cs","lineNumber":255,"sourceCode":"\n                _handlers[commandName] = handlerInfo;\n                return true;\n            }\n            catch (Exception ex)\n            {\n                McpLog.Error($\"Failed to register {typeLabel} {type.Name}: {ex.Message}\");\n                return false;\n            }\n        }\n\n        /// <summary>\n        /// Get a command handler by name\n        /// </summary>\n        private static HandlerInfo GetHandlerInfo(string commandName)\n        {\n            if (!_handlers.TryGetValue(commandName, out var handler))\n            {\n                throw new InvalidOperationException(\n                    $\"Unknown or unsupported command type: {commandName}\"\n                );\n            }\n            return handler;\n        }\n\n        /// <summary>\n        /// Get a synchronous command handler by name.\n        /// Throws if the command is asynchronous.\n        /// </summary>\n        /// <param name=\"commandName\"></param>\n        /// <returns></returns>\n        /// <exception cref=\"InvalidOperationException\"></exception>\n        public static Func<JObject, object> GetHandler(string commandName)\n        {\n            var handlerInfo = GetHandlerInfo(commandName);\n            if (handlerInfo.IsAsync)\n            {","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/MCPForUnity/Editor/Tools/CommandRegistry.cs#L237-L273","documentation":"GetHandlerInfo looks up the requested command name in the _handlers dictionary, which is populated by reflection auto-discovery of [McpForUnityTool]/[McpForUnityResource] types during CommandRegistry.Initialize. A miss means no handler is registered under that name.","triggerScenarios":"The tool belongs to a non-core group (vfx, animation, ui, etc.) that starts disabled and was never toggled on; the Python server and Unity plugin versions are mismatched so names diverge; reflection discovery failed silently at startup; CommandRegistry.Initialize was never called.","commonSituations":"Calling an animation/vfx tool before enabling its group via manage_tools; updated the Python server but not the Unity package (or vice versa); a compile error in the package prevented a tool class from registering.","solutions":["Enable the tool's group via manage_tools (non-core groups start disabled).","Verify the Python server and Unity plugin versions match.","Check the Unity console for 'Failed to register' errors from auto-discovery.","Ensure CommandRegistry.Initialize() has run before dispatching commands."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!CommandRegistry.IsRegistered(commandName))\n{\n    return new ErrorResponse($\"Command '{commandName}' is not available. Enable its tool group or verify Python/Unity versions match.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    var result = CommandRegistry.ExecuteCommand(commandName, @params, tcs);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Unknown or unsupported command type\"))\n{\n    return new ErrorResponse($\"'{commandName}' is not registered. Check that its tool group is enabled and versions match.\");\n}","preventionTips":["Enable non-core tool groups (vfx, animation, ...) via manage_tools before use.","Keep the Python server and Unity plugin on matching versions.","Watch the Unity console for 'Failed to register' warnings at startup."],"tags":["registry","tools","config"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}