{"record":{"id":"0f065989772a72cb","repo":"CoplayDev/unity-mcp","slug":"input-paths-cannot-be-null","errorCode":null,"errorMessage":"Input paths cannot be null","messagePattern":"Input paths 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":37,"sourceCode":"        }\r\n\r\n        public async Task<PreviewGenerationResult> Generate()\r\n        {\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":19,"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#L19-L45","documentation":"Thrown by PreviewGeneratorBase.Validate() (PreviewGeneratorBase.cs:37) when Settings.InputPaths is null or empty. InputPaths is the string[] of asset folders passed to AssetDatabase.FindAssets; null/empty means there is nothing to scan. This base check runs for every generator (both Native and Custom call base.Validate() first), before GenerateImpl() and outside its try/catch, so it propagates as an uncaught ArgumentException.","triggerScenarios":"Calling Generate() on any generator whose InputPaths was never set (null) or set to an empty array. Happens when settings are constructed without InputPaths, or when a path picker returns an empty selection.","commonSituations":"Settings initializer that sets OutputPath but not InputPaths; UI flow that lets the user click Generate with no input paths selected; deserialization that produced an empty array.","solutions":["Set Settings.InputPaths to a non-empty string[] of asset paths before Generate().","Guard the UI: disable Generate until at least one input path is chosen.","Verify InputPaths is populated right after constructing the settings object."],"exampleFix":"// before\nvar settings = new CustomPreviewGenerationSettings { OutputPath = outPath, Width = 256, Height = 128, Depth = 100, NativeWidth = 1024, NativeHeight = 1024 };\nawait new CustomPreviewGenerator(settings).Generate(); // InputPaths null -> throws\n\n// after\nvar settings = new CustomPreviewGenerationSettings { InputPaths = new[] { \"Assets/MyPack\" }, OutputPath = outPath, Width = 256, Height = 128, Depth = 100, NativeWidth = 1024, NativeHeight = 1024 };\nawait new CustomPreviewGenerator(settings).Generate();","handlingStrategy":"validation","validationCode":"if (settings.InputPaths == null || settings.InputPaths.Length == 0)\n    throw new InvalidOperationException(\"PreviewGenerationSettings.InputPaths must be a non-empty array before generating.\");","typeGuard":"static bool HasInputPaths(PreviewGenerationSettings s) => s != null && s.InputPaths != null && s.InputPaths.Length > 0;","tryCatchPattern":"try { await generator.Generate(); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Input paths\")) { /* report missing input paths */ }","preventionTips":["Always set InputPaths at construction.","Disable the Generate button in the UI until at least one input path is selected."],"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"}