{"record":{"id":"b74369d666a68156","repo":"CoplayDev/unity-mcp","slug":"output-path-cannot-be-null-b74369","errorCode":null,"errorMessage":"Output path cannot be null","messagePattern":"Output path cannot be null","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Previews/Scripts/Generators/PreviewGeneratorBase.cs","lineNumber":40,"sourceCode":"        {\r\n            Validate();\r\n\r\n            var result = await GenerateImpl();\r\n            if (result.Success)\r\n            {\r\n                CachingService.CacheMetadata(result.GeneratedPreviews);\r\n            }\r\n\r\n            return result;\r\n        }\r\n\r\n        protected virtual void Validate()\r\n        {\r\n            if (Settings.InputPaths == null || Settings.InputPaths.Length == 0)\r\n                throw new ArgumentException(\"Input paths cannot be null\");\r\n\r\n            if (string.IsNullOrEmpty(Settings.OutputPath))\r\n                throw new ArgumentException(\"Output path cannot be null\");\r\n        }\r\n\r\n        protected abstract Task<PreviewGenerationResult> GenerateImpl();\r\n    }\r\n}","sourceCodeStart":22,"sourceCodeEnd":45,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Previews/Scripts/Generators/PreviewGeneratorBase.cs#L22-L45","documentation":"Thrown by PreviewGeneratorBase.Validate() (PreviewGeneratorBase.cs:40) when Settings.OutputPath is null or empty. OutputPath is where preview files are written (Directory.CreateDirectory and file writes use it). Null/empty would make file IO fail. Base check, runs for all generators before GenerateImpl(), outside its try/catch — an uncaught ArgumentException.","triggerScenarios":"Calling Generate() with OutputPath unset (null) or set to an empty string. Occurs when settings are built without OutputPath, or when an output-folder picker returns empty.","commonSituations":"Settings initializer that sets InputPaths but not OutputPath; UI flow that allows Generate with no output folder chosen; a path that was cleared before submit.","solutions":["Set Settings.OutputPath to a non-empty folder path before Generate().","Disable Generate in the UI until an output path is selected.","Assign OutputPath alongside InputPaths at construction."],"exampleFix":"// before\nvar settings = new CustomPreviewGenerationSettings { InputPaths = paths /* OutputPath missing */ };\nawait new CustomPreviewGenerator(settings).Generate(); // throws\n\n// after\nvar settings = new CustomPreviewGenerationSettings { InputPaths = paths, OutputPath = \"Assets/Previews\" };\nawait new CustomPreviewGenerator(settings).Generate();","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(settings.OutputPath))\n    throw new InvalidOperationException(\"PreviewGenerationSettings.OutputPath must be a non-empty path before generating.\");","typeGuard":"static bool HasOutputPath(PreviewGenerationSettings s) => s != null && !string.IsNullOrEmpty(s.OutputPath);","tryCatchPattern":"try { await generator.Generate(); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Output path\")) { /* report missing output path */ }","preventionTips":["Always assign OutputPath alongside InputPaths.","Disable Generate in the UI until an output folder is chosen."],"tags":["unity","asset-store-tools","preview-generation","validation","argument-exception"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}