Unity-Technologies/UnityCsReference · error · ApplicationException
Couldn't create device API for device: {deviceId}
Error message
Couldn't create device API for device: {deviceId} What it means
Thrown by ModuleManager.GetDevice when DevDeviceList.FindDevice returns false — no device with the given deviceId is registered in the device list at all. This is the outer guard, distinct from 402 which fires when the device exists but its module is missing.
Source
Thrown at Editor/Mono/Modules/ModuleManager.cs:285
if (platformSupportModulesByGuid.TryGetValue(platformGuid, out var module))
return module;
return null;
}
internal static IDevice GetDevice(string deviceId)
{
DevDevice device;
if (DevDeviceList.FindDevice(deviceId, out device))
{
IPlatformSupportModule module = FindPlatformSupportModule(device.module);
if (module != null)
return module.CreateDevice(deviceId);
else
throw new ApplicationException("Couldn't find module for target: " + device.module);
}
throw new ApplicationException("Couldn't create device API for device: " + deviceId);
}
internal static IBuildTarget GetIBuildTarget(BuildTarget target)
{
var targetModuleName = BuildTargetDiscovery.GetModuleNameForBuildTarget(target);
if (platformSupportModules.TryGetValue(targetModuleName, out var module))
{
return module.PlatformBuildTarget;
}
return null;
}
internal static IBuildTarget GetIBuildTarget(GUID platformGuid)
{
if (platformSupportModulesByGuid.TryGetValue(platformGuid, out var module))
{
if (module.PlatformBuildTarget.Guid == platformGuid)View on GitHub (pinned to 225b0fbdb5)
Solutions
- Verify the device is connected and recognized: refresh the device list (DevDeviceList) before calling GetDevice.
- Check the deviceId string for typos or trailing whitespace.
- Install/enable the device's USB driver or network discovery provider.
- Wrap the call and fall back to a re-scan: if FindDevice fails, re-enumerate then retry once.
Example fix
// before
IDevice d = ModuleManager.GetDevice(deviceId); // throws if device gone
// after
DevDevice device;
if (DevDeviceList.FindDevice(deviceId, out device))
IDevice d = ModuleManager.GetDevice(deviceId);
else
RefreshDeviceList(); Defensive patterns
Strategy: validation
Validate before calling
DevDevice dev;
if (DevDeviceList.FindDevice(deviceId, out dev))
IDevice d = ModuleManager.GetDevice(deviceId); Try / catch
try { var d = ModuleManager.GetDevice(id); }
catch (ApplicationException ex) when (ex.Message.Contains("create device"))
{ /* device gone — re-enumerate */ } Prevention
- Re-enumerate the device list before use.
- Validate deviceId strings for whitespace.
- Handle device disconnect between discovery and use.
When it happens
Trigger: Calling ModuleManager.GetDevice(deviceId) with an ID that does not match any entry in DevDeviceList (e.g., disconnected device, stale ID from a previous session, typo).
Common situations: Device disconnected between discovery and use. DeviceId read from a saved editor state that no longer resolves. Device driver not installed so FindDevice never populates the list.
Related errors
- Couldn't find module for target: {device.module}
- target must be valid
- Cannot add {moduleName} after UnityLinker has run because it
- Cannot add module {moduleName} because it has dependencies o
- path
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/f5e592fbd3358648.
Report an issue: GitHub.