Generating electric field from electric potential

Please make a minimal reproducible example.
It seems like you are trying to do a projection of a solution with 3 million dofs into something with more than 10 million dofs (vector space and DG).

Then you need to specify an iterative solver when solving, or use the LocalSolver in legacy FEniCS.
See for instance: Error: Unable to orthonormalize vector basis. Reason: Vector space has linear dependency. Where: This error was encountered inside Vector Space Basis.cpp - #10 by dokken