{"record":{"id":"5839712966b4684c","repo":"CoplayDev/unity-mcp","slug":"output-path-cannot-be-null","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/Custom/TypeGenerators/TypePreviewGeneratorBase.cs","lineNumber":36,"sourceCode":"        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\n            assets = FilterIgnoredAssets(assets);\r\n\r\n            if (assets.Count() == 0)\r\n                return generatedPreviews;\r\n\r\n            return await GenerateImpl(assets);\r\n        }\r\n\r\n        protected abstract IEnumerable<UnityEngine.Object> CollectAssets();\r\n\r","sourceCodeStart":18,"sourceCodeEnd":54,"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#L18-L54","documentation":"Thrown by TypePreviewGeneratorBase.ValidateSettings when Settings.OutputPath is null or an empty string. OutputPath is where generated preview images are written. This base-class validation runs after the InputPaths loop.","triggerScenarios":"Calling Generate() with Settings.OutputPath being null or string.Empty. ValidateSettings checks string.IsNullOrEmpty(Settings.OutputPath).","commonSituations":"Settings constructed without setting OutputPath; UI dialog for output folder was cancelled; deserialized config missing the output path field; OutputPath set to a whitespace-only string.","solutions":["Set Settings.OutputPath to a valid writable directory path before calling Generate.","Default OutputPath to a known preview output directory if the user didn't specify one.","Check for null/empty at the call site and prompt for or assign a default output location."],"exampleFix":"// before\nvar settings = new TextureTypeGeneratorSettings { InputPaths = paths, OutputPath = null, MaxWidth = 1024, MaxHeight = 1024 };\n\n// after\nvar settings = new TextureTypeGeneratorSettings { InputPaths = paths, OutputPath = \"Assets/PreviewOutput\", MaxWidth = 1024, MaxHeight = 1024 };","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(settings.OutputPath))\n    settings.OutputPath = \"Assets/PreviewOutput\"; // default\n// or validate:\nif (string.IsNullOrEmpty(settings.OutputPath))\n    throw new InvalidOperationException(\"OutputPath must be set to a valid directory.\");","typeGuard":"static bool HasValidOutputPath(TypeGeneratorSettings s)\n    => !string.IsNullOrEmpty(s?.OutputPath);","tryCatchPattern":"try\n{\n    await generator.Generate();\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Output path cannot be null\"))\n{\n    settings.OutputPath = \"Assets/PreviewOutput\";\n    await generator.Generate();\n}","preventionTips":["Set OutputPath to a known writable directory before calling Generate.","Default OutputPath when the user doesn't specify one.","Check for null/empty after deserialization and apply a default."],"tags":["unity","asset-store-tools","preview","validation","path"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}