Error in L502 means that the SCF failed to converge for a geometry. It happens because the default settings for gaussian is to do at maximum 128 SCF cycles, if your convergence requires more than that the job will fail at the 129th.
You have many options to try and converge your system: You can increase the number of SCF cycles "scf(maxcycles=N)"; Try a virtual shift "scf(vshift=N)"; Try using quadratic convergence "scf(qc)" or even changing grids and accuracy. The number of options is enormous and depends mostly on the physical nature of your system.