{"record":{"id":"4affd28c1372c9c3","repo":"Unity-Technologies/UnityCsReference","slug":"the-name-is-empty","errorCode":null,"errorMessage":"The name is empty","messagePattern":"The name is empty","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/AssetPipeline/AssetImporter.bindings.cs","lineNumber":52,"sourceCode":"                this.type = asset.GetType();\n                this.name = asset.name;\n            }\n\n            public SourceAssetIdentifier(Type type, string name)\n            {\n                if (type == null)\n                {\n                    throw new ArgumentNullException(\"type\");\n                }\n\n                if (name == null)\n                {\n                    throw new ArgumentNullException(\"name\");\n                }\n\n                if (string.IsNullOrEmpty(name))\n                {\n                    throw new ArgumentException(\"The name is empty\", \"name\");\n                }\n\n                this.type = type;\n                this.name = name;\n            }\n\n            public Type type;\n            public string name;\n        }\n\n        [NativeName(\"AssetPathName\")]\n        public extern  string assetPath\n        {\n            get;\n        }\n\n        public extern  bool importSettingsMissing\n        {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/AssetPipeline/AssetImporter.bindings.cs#L34-L70","documentation":"AssetImporter.SourceAssetIdentifier(Type type, string name) constructor throws ArgumentException with message 'The name is empty' when name is a non-null empty string. This is a separate guard from the null check (error 35): it catches the case where name is \"\" specifically, because an empty name cannot identify a sub-asset for remapping. The constructor distinguishes null (ArgumentNullException) from empty (ArgumentException).","triggerScenarios":"Constructing new SourceAssetIdentifier(type, \"\") where name is an empty string but not null. This happens when deserializing data with present-but-empty name fields, or when asset.name returns empty string for unnamed assets.","commonSituations":"Loading remap configuration from external sources where name fields exist but are blank. Also occurs with programmatically created assets that have empty names, or after renaming operations that set name to empty before reassignment.","solutions":["Check string.IsNullOrEmpty(name) before constructing: if (!string.IsNullOrEmpty(name)) new SourceAssetIdentifier(type, name).","Filter out blank-named sub-assets when building identifier lists.","Ensure serialized name fields are populated with meaningful values, not empty strings."],"exampleFix":"// before\nvar id = new SourceAssetIdentifier(type, assetName);\n\n// after\nif (!string.IsNullOrEmpty(assetName))\n    var id = new SourceAssetIdentifier(type, assetName);\nelse\n    Debug.LogWarning($\"Skipping SourceAssetIdentifier for type {type.Name}: name is empty\");","handlingStrategy":"validation","validationCode":"if (!string.IsNullOrEmpty(name))\n    var id = new AssetImporter.SourceAssetIdentifier(type, name);\nelse\n    Debug.LogWarning($\"Skipping SourceAssetIdentifier for {type.Name}: name is empty\");","typeGuard":"static bool IsValidIdentifierName(string name) => !string.IsNullOrEmpty(name);","tryCatchPattern":"try { var id = new AssetImporter.SourceAssetIdentifier(type, name); }\ncatch (ArgumentException ex) when (ex.Message == \"The name is empty\")\n{ Debug.LogWarning($\"Skipped SourceAssetIdentifier: name was empty\"); }","preventionTips":["Check string.IsNullOrEmpty to cover both null and empty cases","Ensure sub-asset names are populated with meaningful values","Filter out blank-named assets when building remap configurations"],"tags":["unity","csharp","asset-pipeline","asset-importer","source-asset-identifier","argument-validation"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}