Java dies with NullPointerException during comple of .ino file

Oof. It is challenging to investigate this sort of bug that occurs inconsistently and only with a complex setup. The first step in the process must be to reproduce the issue and then to bisect it. If you can distill it down to a very minimal demonstration that will still reproduce the problem then often the cause becomes clear. But we aren't always to fortunate to have well behaved bugs that allow such a thing.