{"record":{"id":"2b35c72331a55f85","repo":"Unity-Technologies/UnityCsReference","slug":"installpath-must-not-be-an-empty-string","errorCode":null,"errorMessage":"{installPath} must not be an empty string","messagePattern":"(.+?) must not be an empty string","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs","lineNumber":337,"sourceCode":"                else\n                    config.Set(keyValue.Key, keyValue.Value);\n            }\n        }\n\n        [RequiredByNativeCode]\n        static public void Postprocess(BuildTarget target, int subtarget, string installPath, string companyName, string productName,\n            BuildOptions options,\n            RuntimeClassRegistry usedClassRegistry, BuildReport report, string[] defineConstraints)\n        {\n            string stagingArea = \"Temp/StagingArea\";\n            string stagingAreaData = \"Temp/StagingArea/Data\";\n            string stagingAreaDataManaged = \"Temp/StagingArea/Data/Managed\";\n            string playerPackage = BuildPipeline.GetPlaybackEngineDirectory(target, options);\n\n            // Disallow providing an empty string as the installPath\n            bool willInstallInBuildFolder = (options & BuildOptions.InstallInBuildFolder) != 0 && SupportsInstallInBuildFolder(target);\n            if (installPath == String.Empty && !willInstallInBuildFolder)\n                throw new Exception(installPath + \" must not be an empty string\");\n\n            IBuildPostprocessor postprocessor = ModuleManager.GetBuildPostProcessor(target);\n            if (postprocessor == null)\n                // If postprocessor is not provided, build target is not supported\n                throw new UnityException($\"Build target '{target}' not supported\");\n\n            try\n            {\n                AddIconsArgs iconArgs;\n                iconArgs.stagingArea = stagingArea;\n                if (!postprocessor.AddIconsToBuild(iconArgs))\n                    throw new BuildFailedException(\"Failed to add player icon\");\n\n                BuildPostProcessArgs args;\n                args.target = target;\n                args.subtarget = subtarget;\n                args.stagingAreaData = stagingAreaData;\n                args.stagingArea = stagingArea;","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs#L319-L355","documentation":"Postprocess throws when installPath is String.Empty and the build is not flagged with BuildOptions.InstallInBuildFolder (or that option isn't supported for the target). An empty install path is only legal for targets that install into the build folder; otherwise a concrete output location is mandatory.","triggerScenarios":"Calling Postprocess (or triggering a build) with an empty installPath while BuildOptions.InstallInBuildFolder is unset or SupportsInstallInBuildFolder(target) is false.","commonSituations":"Programmatic BuildPipeline.BuildPlayer with an empty locationPathName for a target that requires one (e.g. Standalone, mobile); a build script forgot to set the output path.","solutions":["Provide a non-empty installPath / locationPathName for the build.","If you intend in-build-folder installation, set BuildOptions.InstallInBuildFolder and ensure the target supports it.","Validate installPath is non-empty before invoking Postprocess."],"exampleFix":"// before\nBuildPipeline.BuildPlayer(new BuildPlayerOptions {\n    scenes = scenes, target = BuildTarget.StandaloneWindows64,\n    locationPathName = \"\" // empty -> throws\n});\n\n// after\nBuildPipeline.BuildPlayer(new BuildPlayerOptions {\n    scenes = scenes, target = BuildTarget.StandaloneWindows64,\n    locationPathName = \"Build/MyGame.exe\"\n});","handlingStrategy":"validation","validationCode":"bool willInstallInBuildFolder = (options & BuildOptions.InstallInBuildFolder) != 0 && SupportsInstallInBuildFolder(target);\nif (string.IsNullOrEmpty(installPath) && !willInstallInBuildFolder)\n    throw new ArgumentException(nameof(installPath), \"installPath must not be empty for this target.\");","typeGuard":"static bool IsValidInstallPath(string path, BuildOptions opts, BuildTarget t) =>\n    !string.IsNullOrEmpty(path) ||\n    ((opts & BuildOptions.InstallInBuildFolder) != 0 && SupportsInstallInBuildFolder(t));","tryCatchPattern":null,"preventionTips":["Always pass an explicit locationPathName for targets that require one.","Set BuildOptions.InstallInBuildFolder only for targets that support it."],"tags":["build-pipeline","postprocess","install-path","validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}