{"record":{"id":"ac92e4b18e632cdd","repo":"Unity-Technologies/UnityCsReference","slug":"assetormetafilepaths","errorCode":null,"errorMessage":"assetOrMetaFilePaths","messagePattern":"assetOrMetaFilePaths","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/AssetDatabase/AssetDatabase.cs","lineNumber":108,"sourceCode":"        }\n\n        [RequiredByNativeCode]\n        private static void Internal_CallImportPackageFailed(string packageName, string errorMessage)\n        {\n            foreach (var evt in m_importPackageFailedEvent)\n                evt(packageName, errorMessage);\n        }\n\n        [RequiredByNativeCode]\n        private static bool Internal_IsOpenForEdit(string assetOrMetaFilePath)\n        {\n            return IsOpenForEdit(assetOrMetaFilePath);\n        }\n\n        public static void CanOpenForEdit(string[] assetOrMetaFilePaths, List<string> outNotEditablePaths, [uei.DefaultValue(\"StatusQueryOptions.UseCachedIfPossible\")] StatusQueryOptions statusQueryOptions = StatusQueryOptions.UseCachedIfPossible)\n        {\n            if (assetOrMetaFilePaths == null)\n                throw new ArgumentNullException(nameof(assetOrMetaFilePaths));\n            if (outNotEditablePaths == null)\n                throw new ArgumentNullException(nameof(outNotEditablePaths));\n            UnityEngine.Profiling.Profiler.BeginSample(\"AssetDatabase.CanOpenForEdit\");\n            AssetModificationProcessorInternal.CanOpenForEdit(assetOrMetaFilePaths, outNotEditablePaths, statusQueryOptions);\n            UnityEngine.Profiling.Profiler.EndSample();\n        }\n\n        public static void IsOpenForEdit(string[] assetOrMetaFilePaths, List<string> outNotEditablePaths, [uei.DefaultValue(\"StatusQueryOptions.UseCachedIfPossible\")] StatusQueryOptions statusQueryOptions = StatusQueryOptions.UseCachedIfPossible)\n        {\n            if (assetOrMetaFilePaths == null)\n                throw new ArgumentNullException(nameof(assetOrMetaFilePaths));\n            if (outNotEditablePaths == null)\n                throw new ArgumentNullException(nameof(outNotEditablePaths));\n            UnityEngine.Profiling.Profiler.BeginSample(\"AssetDatabase.IsOpenForEdit\");\n            AssetModificationProcessorInternal.IsOpenForEdit(assetOrMetaFilePaths, outNotEditablePaths, statusQueryOptions);\n            UnityEngine.Profiling.Profiler.EndSample();\n        }\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/AssetDatabase/AssetDatabase.cs#L90-L126","documentation":"Thrown by AssetDatabase.CanOpenForEdit when the assetOrMetaFilePaths array is null. The method forwards to AssetModificationProcessorInternal.CanOpenForEdit which iterates the paths; a null array has no elements and no Length, so the guard throws ArgumentNullException(nameof(assetOrMetaFilePaths)) before profiling/VCS lookup.","triggerScenarios":"Calling CanOpenForEdit(null, outList). Passing a selection-derived array that came back null when nothing was selected. Forwarding the result of AssetDatabase.GetAssetPath on a null selection.","commonSituations":"Editor context-menu actions that operate on selected assets but run with empty/null selection. Version-control pre-checks in batch tools. Build hooks verifying editability of generated paths.","solutions":["Early-return when the path array is null or empty.","Build paths with an explicit fallback: paths ?? Array.Empty<string>().","Validate selection before deriving paths: Selection.objects may be empty.","Log the originating operation when paths come back null to find the upstream gap."],"exampleFix":"// before\nAssetDatabase.CanOpenForEdit(selectedPaths, notEditable, StatusQueryOptions.UseCachedIfPossible);\n\n// after\nif (selectedPaths == null || selectedPaths.Length == 0) return;\nAssetDatabase.CanOpenForEdit(selectedPaths, notEditable, StatusQueryOptions.UseCachedIfPossible);","handlingStrategy":"validation","validationCode":"if (assetOrMetaFilePaths == null || assetOrMetaFilePaths.Length == 0) return;","typeGuard":"static bool HasPaths(string[] p) => p != null && p.Length > 0;","tryCatchPattern":null,"preventionTips":["Early-return on null/empty path arrays in editor menu actions.","Validate Selection.objects before deriving paths.","Normalize collectors to Array.Empty<string>() instead of null."],"tags":["asset-database","argument-null","version-control","editor","csharp"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}