{"record":{"id":"89a16c1cf75166e2","repo":"Unity-Technologies/UnityCsReference","slug":"could-not-launch-build","errorCode":null,"errorMessage":"Could not launch build","messagePattern":"Could not launch build","errorType":"exception","errorClass":"NoTargetsFoundException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs","lineNumber":284,"sourceCode":"                            if (launchResult != null && launchResult.Success)\n                                successfulLaunches++;\n                        }\n                        catch (DeploymentOperationFailedException e)\n                        {\n                            launchResult = e.launchResult;\n                            exceptions.Add(e);\n                        }\n\n                        launches.Add(launchResult);\n                    }\n\n                    foreach (var e in exceptions)\n                        UnityEngine.Debug.LogException(e);\n\n                    if (successfulLaunches == 0)\n                    {\n                        // TODO: Maybe more specifically no compatible targets?\n                        throw new NoTargetsFoundException(\"Could not launch build\");\n                    }\n                });\n\n                taskManager.Run();\n            }\n            catch (DeploymentOperationFailedException e)\n            {\n                UnityEngine.Debug.LogException(e);\n                EditorUtility.DisplayDialog(e.title, e.Message, \"OK\");\n            }\n            catch (DeploymentOperationAbortedException)\n            {\n                System.Console.WriteLine(\"Deployment aborted\");\n            }\n            catch (NoTargetsFoundException e)\n            {\n                Debug.LogException(e);\n                throw new UnityException(string.Format(\"Could not find any valid targets to launch on for {0}\", buildTarget));","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs#L266-L302","documentation":"NoTargetsFoundException with message 'Could not launch build' is thrown after the deployment task manager runs all launch attempts and zero launches succeeded. It aggregates per-target failures logged via Debug.LogException, then signals that no compatible target was available.","triggerScenarios":"The launch/deployment flow enumerates candidate targets to run on, but every candidate failed its launch attempt (device disconnected, emulator not running, incompatible target) leaving successfulLaunches == 0.","commonSituations":"Launching to a mobile/AR platform with no device or emulator connected; all candidate devices rejected the build (wrong OS version, locked device); network-deployed targets unreachable.","solutions":["Connect and authorize at least one compatible device/emulator for the target platform before Build and Run.","Inspect the Debug.LogException entries emitted just before this throw to find the per-target failure cause.","If launching to a remote target, verify it is online and reachable, then retry."],"exampleFix":"/* no source edit */\n// before: Build and Run with no device attached -> NoTargetsFoundException\n// after: connect + authorize device (e.g. `adb devices` shows it, or boot the simulator)\n// then Build and Run","handlingStrategy":"try-catch","validationCode":"// Verify at least one candidate target is discoverable before launching\nif (DeploymentTargets.Count(buildTarget) == 0)\n    EditorUtility.DisplayDialog(\"Launch\", $\"No connected target for {buildTarget}.\", \"OK\");","typeGuard":null,"tryCatchPattern":"try { launches = PostprocessBuildPlayer.LaunchPlayer(...); }\ncatch (NoTargetsFoundException ex)\n{ Debug.LogWarning($\"No launch target: {ex.Message}\"); launches = new List<LaunchResult>(); }","preventionTips":["Connect and authorize a compatible device/emulator before Build and Run.","Review per-target Debug.LogException entries to diagnose launch failures."],"tags":["launch","deployment","device","no-targets"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}