{"record":{"id":"8e70b450c36dc1fa","repo":"Unity-Technologies/UnityCsReference","slug":"the-output-path-buildparameters-outputpath-doe","errorCode":null,"errorMessage":"The output path \"{buildParameters.outputPath}\" doesn't exist","messagePattern":"The output path \"(.+?)\" doesn't exist","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs","lineNumber":763,"sourceCode":"                buildParameters.targetPlatform = EditorUserBuildSettings.activeBuildTarget;\n\n                // Note: subtarget is associated with multiple enums, and 0 may have a specific meaning,\n                // so we only auto-set it when the target is also coming from the build settings\n                buildParameters.subtarget = EditorUserBuildSettings.GetActiveSubtargetFor(buildParameters.targetPlatform);\n            }\n\n            // For Standalone platforms, the Default subtarget means to use the current active one\n            if (GetBuildTargetGroup(buildParameters.targetPlatform) == BuildTargetGroup.Standalone &&\n                (StandaloneBuildSubtarget)buildParameters.subtarget == StandaloneBuildSubtarget.Default)\n            {\n                buildParameters.subtarget = EditorUserBuildSettings.GetActiveSubtargetFor(buildParameters.targetPlatform);\n            }\n\n            if (isBuildingPlayer)\n                throw new InvalidOperationException(\"Cannot build asset bundles while a build is in progress.\");\n\n            if (!System.IO.Directory.Exists(buildParameters.outputPath))\n                throw new ArgumentException(\"The output path \\\"\" + buildParameters.outputPath + \"\\\" doesn't exist\");\n\n            return BuildAssetBundlesInternal(buildParameters);\n        }\n\n        [NativeMethod(ThrowsException = true)]\n        private static extern AssetBundleManifest BuildAssetBundlesInternal(BuildAssetBundlesParameters buildParameters);\n\n        [FreeFunction(\"GetPlayerDataCache\")]\n        internal static extern string GetDataCacheForBuildTarget(BuildTarget target, int subtarget);\n\n        [FreeFunction(\"GetPlayerDataSessionId\")]\n        internal static extern string GetSessionIdForBuildTarget(BuildTarget target, int subtarget);\n\n        [FreeFunction(\"GetDataBuildDirtyInfoPath\")]\n        internal static extern string GetBuildDirtyInfoForBuildTarget(BuildTarget target, int subtarget);\n\n        ///<summary>Extract the CRC checksum for the given AssetBundle.</summary>\n        ///<remarks>A 32-bit checksum is generated during the AssetBundle build process and recorded in the .manifest file and exposed by this method.</remarks>","sourceCodeStart":745,"sourceCodeEnd":781,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs#L745-L781","documentation":"Thrown by BuildAssetBundles when the outputPath directory does not exist on disk. Unlike BuildContentDirectory which attempts on-the-fly creation, BuildAssetBundles requires the output directory to already exist before the build starts.","triggerScenarios":"Calling BuildPipeline.BuildAssetBundles with an outputPath pointing to a directory that hasn't been created yet, or that was deleted between the check and the call.","commonSituations":"Build scripts that assume the output folder exists from a prior run, CI clean-room environments where build artifacts are wiped between runs, or paths derived from environment variables that resolve to non-existent directories.","solutions":["Create the output directory with Directory.CreateDirectory(outputPath) before calling BuildAssetBundles.","Verify Directory.Exists(outputPath) returns true before the call and log the resolved absolute path if it fails.","In CI, add an explicit mkdir step or a pre-build script that ensures the directory tree exists."],"exampleFix":"// before\nstring outputPath = \"Build/Bundles\";\nBuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);\n\n// after\nstring outputPath = \"Build/Bundles\";\nDirectory.CreateDirectory(outputPath);\nBuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);","handlingStrategy":"validation","validationCode":"string EnsureOutputDirectory(string outputPath)\n{\n    if (!Directory.Exists(outputPath))\n        Directory.CreateDirectory(outputPath);\n    return outputPath;\n}\n\n// Before BuildAssetBundles:\nEnsureOutputDirectory(outputPath);\nBuildPipeline.BuildAssetBundles(outputPath, options, target);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call Directory.CreateDirectory(outputPath) before every BuildAssetBundles invocation.","In CI, add an explicit directory creation step in the build script.","Log the resolved absolute path when the check fails to catch environment variable issues."],"tags":["unity","build-pipeline","asset-bundles","directory-not-found","path-validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}