With the error commented out, I think all the faces from that point onward will just have wrong lightmaps. Might only affect a corner of the map.
Dynamic or increases limit - not sure how much more work it is to make it dynamic, probably not too bad?
In quakespasm I was lazy and just raised the limits, MAX_LIGHTMAPS is 512, and the textures are 128x128.
btw, this is a useful optimization to apply, starts searching at the last block rather than testing all of the filled ones (the original code looks at n^2 lightmaps to fill n lightmaps).https://github.com/ericwa/Quakespasm/commit/accee12