{"record":{"id":"6ad3c63159313921","repo":"CoplayDev/unity-mcp","slug":"input-path-cannot-be-null","errorCode":null,"errorMessage":"Input path cannot be null","messagePattern":"Input 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/Custom/TypeGenerators/TypePreviewGeneratorBase.cs","lineNumber":26,"sourceCode":"using UnityEditor;\r\n\r\nnamespace AssetStoreTools.Previews.Generators.Custom.TypeGenerators\r\n{\r\n    internal abstract class TypePreviewGeneratorBase : ITypePreviewGenerator\r\n    {\r\n        public TypeGeneratorSettings Settings { get; }\r\n\r\n        public abstract event Action<int, int> OnAssetProcessed;\r\n\r\n        public TypePreviewGeneratorBase(TypeGeneratorSettings settings)\r\n        {\r\n            Settings = settings;\r\n        }\r\n\r\n        public virtual void ValidateSettings()\r\n        {\r\n            if (Settings.InputPaths == null || Settings.InputPaths.Length == 0)\r\n                throw new ArgumentException(\"Input path cannot be null\");\r\n\r\n            foreach (var path in Settings.InputPaths)\r\n            {\r\n                var inputPath = path.EndsWith(\"/\") ? path.Remove(path.Length - 1) : path;\r\n                if (!AssetDatabase.IsValidFolder(inputPath))\r\n                    throw new ArgumentException($\"Input path '{inputPath}' is not a valid ADB folder\");\r\n            }\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        public async Task<List<PreviewMetadata>> Generate()\r\n        {\r\n            var generatedPreviews = new List<PreviewMetadata>();\r\n            ValidateSettings();\r\n\r\n            var assets = CollectAssets();\r","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Previews/Scripts/Generators/Custom/TypeGenerators/TypePreviewGeneratorBase.cs#L8-L44","documentation":"Thrown by TypePreviewGeneratorBase.ValidateSettings when Settings.InputPaths is null or an empty array. This is the base-class validation for all type-based preview generators (texture, audio, scene). InputPaths must contain at least one AssetDatabase folder path.","triggerScenarios":"Calling Generate() on any TypePreviewGeneratorBase subclass with Settings.InputPaths being null or having Length == 0. ValidateSettings is called at the top of Generate().","commonSituations":"Settings constructed without InputPaths; UI didn't bind the input folder selection; deserialized settings with a null InputPaths field; programmatic caller passed an empty array.","solutions":["Populate Settings.InputPaths with at least one valid AssetDatabase folder path before calling Generate.","Check for null/empty at the call site and report a clear upstream error.","If paths come from user input, validate selection before starting preview generation."],"exampleFix":"// before\nvar settings = new TextureTypeGeneratorSettings { InputPaths = new string[0], OutputPath = outPath, MaxWidth = 1024, MaxHeight = 1024 };\n\n// after\nvar settings = new TextureTypeGeneratorSettings { InputPaths = new[] { \"Assets/MyTextures\" }, OutputPath = outPath, MaxWidth = 1024, MaxHeight = 1024 };","handlingStrategy":"validation","validationCode":"if (settings.InputPaths == null || settings.InputPaths.Length == 0)\n    throw new InvalidOperationException(\"InputPaths must contain at least one AssetDatabase folder.\");","typeGuard":"static bool HasValidInputPaths(TypeGeneratorSettings s)\n    => s?.InputPaths != null && s.InputPaths.Length > 0;","tryCatchPattern":"try\n{\n    await generator.Generate();\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Input path cannot be null\"))\n{\n    Debug.LogError(\"No input paths provided for preview generation.\");\n}","preventionTips":["Populate InputPaths from user folder selection before calling Generate.","Validate non-empty InputPaths at the call site.","Use a factory that enforces at least one input path."],"tags":["unity","asset-store-tools","preview","validation","asset-database"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}