{"record":{"id":"c391837ea9634104","repo":"Unity-Technologies/UnityCsReference","slug":"couldn-t-find-module-for-target-device-module","errorCode":null,"errorMessage":"Couldn't find module for target: {device.module}","messagePattern":"Couldn't find module for target: (.+?)","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Modules/ModuleManager.cs","lineNumber":282,"sourceCode":"\n        internal static IPlatformSupportModule FindPlatformSupportModule(GUID platformGuid)\n        {\n            if (platformSupportModulesByGuid.TryGetValue(platformGuid, out var module))\n                return module;\n\n            return null;\n        }\n\n        internal static IDevice GetDevice(string deviceId)\n        {\n            DevDevice device;\n            if (DevDeviceList.FindDevice(deviceId, out device))\n            {\n                IPlatformSupportModule module = FindPlatformSupportModule(device.module);\n                if (module != null)\n                    return module.CreateDevice(deviceId);\n                else\n                    throw new ApplicationException(\"Couldn't find module for target: \" + device.module);\n            }\n\n            throw new ApplicationException(\"Couldn't create device API for device: \" + deviceId);\n        }\n\n        internal static IBuildTarget GetIBuildTarget(BuildTarget target)\n        {\n            var targetModuleName = BuildTargetDiscovery.GetModuleNameForBuildTarget(target);\n            if (platformSupportModules.TryGetValue(targetModuleName, out var module))\n            {\n                return module.PlatformBuildTarget;\n            }\n\n            return null;\n        }\n\n        internal static IBuildTarget GetIBuildTarget(GUID platformGuid)\n        {","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Modules/ModuleManager.cs#L264-L300","documentation":"Thrown by ModuleManager.GetDevice when DevDeviceList.FindDevice succeeds for a deviceId but FindPlatformSupportModule(device.module) returns null — meaning the device exists in the list but its declared module string does not map to a registered IPlatformSupportModule.","triggerScenarios":"Calling ModuleManager.GetDevice(deviceId) for a device whose .module field names a platform support module that is not currently loaded/registered in platformSupportModules.","commonSituations":"Target platform module (e.g., Android, iOS, UWP build support) is not installed in the Unity editor while a connected device of that type is present. Corrupted or manually-edited DevDeviceList entries referencing uninstalled modules.","solutions":["Install the platform Build Support module for the device's platform via Unity Hub > Installs > Add Modules.","Restart the editor after installing modules so platformSupportModules is repopulated.","Verify the device entry in DevDeviceList has the correct .module string matching an installed module name.","Remove stale device entries that reference uninstalled platforms."],"exampleFix":"// before: module not registered, GetDevice throws\nIDevice d = ModuleManager.GetDevice(deviceId);\n// after: guard before calling\nvar dev = DevDeviceList.GetDevices().FirstOrDefault(x => x.id == deviceId);\nif (dev != null && ModuleManager.FindPlatformSupportModule(dev.module) != null)\n    IDevice d = ModuleManager.GetDevice(deviceId);","handlingStrategy":"validation","validationCode":"DevDevice device;\nif (DevDeviceList.FindDevice(deviceId, out device) &&\n    ModuleManager.FindPlatformSupportModule(device.module) != null)\n    var d = ModuleManager.GetDevice(deviceId);","typeGuard":null,"tryCatchPattern":"try { var d = ModuleManager.GetDevice(id); }\ncatch (ApplicationException ex) when (ex.Message.Contains(\"find module\"))\n{ /* prompt user to install the module */ }","preventionTips":["Install platform Build Support modules via Unity Hub.","Re-scan devices after installing modules.","Guard with FindPlatformSupportModule before GetDevice."],"tags":["unity","modules","device","platform-support"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}