Yes i've solved the issue! thanks Zylann for your clarification :)
The question is that when i migrate this debugdraw addon script from GD3 to GD4, i've adapted from ImmediateGeometry to MeshInstance3D+ImmediateMesh, and then translated code from ig.begin(Mesh.PRIMITIVELINES) to mi.mesh.surfacebegin(Mesh.PRIMITIVELINES), that is located in a for loop to draw lines added to itemstodraw Array, then i've MAXMESHSURFACES assertion error in GD4 that before don't occurs with ImmediateGeometry in GD3.
The solution for now is to move mi.mesh.surfacebegin(Mesh.PRIMITIVELINES) out and before the for loop where array items are drawn, and mi.mesh.surface_end() after it, so don't increase the surfaces avoiding the mistake of exceeding the limit of meshes, drawing all grid lines with the same surface ok.