{"record":{"id":"d5fd5f5bf453eb15","repo":"Unity-Technologies/UnityCsReference","slug":"outnoteditablepaths","errorCode":null,"errorMessage":"outNotEditablePaths","messagePattern":"outNotEditablePaths","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/AssetDatabase/AssetDatabase.cs","lineNumber":110,"sourceCode":"        [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\n        [RequiredByNativeCode]\n        private static bool Internal_MakeEditable(string path)","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/AssetDatabase/AssetDatabase.cs#L92-L128","documentation":"Thrown by AssetDatabase.CanOpenForEdit when the outNotEditablePaths List<string> is null. The method writes the subset of paths that are NOT editable into this caller-owned list; a null list cannot be appended to, so the guard throws ArgumentNullException(nameof(outNotEditablePaths)) right after the assetOrMetaFilePaths check.","triggerScenarios":"Calling CanOpenForEdit(paths, null). Forgetting to allocate the output list. Reusing a field that was set to null between calls.","commonSituations":"Editor VCS tooling that conditionally allocates the output list. Context-menu handlers that declare the list lazily but call before allocating. Batch checks that null the list to 'reset' instead of Clear().","solutions":["Allocate the output list before calling: new List<string>().","If reusing, Clear() instead of setting to null.","Pool the list across calls but ensure it is non-null at the call site.","Validate the list and log a context message when null."],"exampleFix":"// before\nvar notEditable = hasFlag ? new List<string>() : null;\nAssetDatabase.CanOpenForEdit(paths, notEditable);\n\n// after\nvar notEditable = new List<string>();\nAssetDatabase.CanOpenForEdit(paths, notEditable);","handlingStrategy":"validation","validationCode":"outNotEditablePaths ??= new List<string>(); outNotEditablePaths.Clear();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always allocate the output List<string> before calling CanOpenForEdit/IsOpenForEdit.","Reset pooled lists with Clear(), not by setting null.","Pool lists across calls but guarantee non-null at the call site."],"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"}