Finding the cause for a NullReferenceException

I get

NullReferenceException: (null)
UnityEditor.SerializedObject..ctor (UnityEngine.Object[] objs) (at C:/BuildAgent/work/812c4f5049264fad/Editor/MonoGenerated/Editor/SerializedPropertyBindings.cs:39)
UnityEditor.AssetImporterInspector.GetSerializedObjectInternal () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/ImportSettings/AssetImporterInspector.cs:52)
UnityEditor.Editor.get_serializedObject () (at C:/BuildAgent/work/812c4f5049264fad/Editor/MonoGenerated/Editor/EditorBindings.cs:71)
UnityEditor.ModelImporterClipEditor.OnEnable () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/ImportSettings/ModelImporterClipEditor.cs:89)

None of the .cs files exists. How to find the cause?

In my case, restarting Unity was the only solution. No idea if something I did helped, but when I closed Unity and opened again, no more such errors could be found!

I got the same error but was solved restarting the Unity IDE

As schaddemm suggests, you should narrow down possible causes.

  1. It looks like it’s importing an animation clip from a model? Try deleting that model from your project (move it somewhere safe). Move all models. No more models? On to step 2:
  2. Start removing code. If you can just disable scripts, do that. If scripts are necessary, start commenting out blocks of code. Eventually the error stops. Last thing you deleted was the culprit.

You may want to just start with and empty project and copy files into it until the error occurs, then you’ll know what the culprit is anyway. Then we can try to figure out what the real problem is. Maybe you have a model with an empty animation key or something.