Creating ScriptableObject inside Editorguilayout InvalidOperationException

Hi,
I’m working on a database with scriptableobjects and editorwindow.
But if I click on the create button in my editorwindow I get an InvalidOperationException.

It still works fine, but the error is annoying.

public void DrawContent() {
 EditorGUILayout.BeginHorizontal();
 
    DrawCreateDB(); // exception
    DrawLoadDB();
 
 EditorGUILayout.EndHorizontal();
}
public void DrawContent(){
 DrawCreateDB(); // no exception
 EditorGUILayout.BeginHorizontal();
        
  DrawLoadDB();
        
 EditorGUILayout.EndHorizontal();
}

I call the ‘DrawContent’ function in OnGUI() in a different class.
‘DrawCreateDB’ have a ‘Guilayout.Button’ and create the asset.

I hope someone can enlighten me.

Can you post the exact error you’re getting ?