I started three new games, and one blank-name town turned up in each of the three games... but in the nml body there isn't a line that's text(" ", 1), of course...
First of all, congrats, you got stuff running, and it worked (mostly).
I fully agree with you that the name of the town is not visible. Having a name consisting of a single space is one form of an 'empty' name (technically it's not empty, it's a non-visible non-empty name, since the string has one space character in it). Other options are of course
(0 spaces, ie the really empty string) or
text(" ", 1)
(with 2 spaces), etc.
Iirc, a town name may consist of several parts, where parts can be optional, so another way to construct an empty name, is to have all parts optional, so the computer can skip all parts, leaving you with 'nothing' as a name.
As for how to find what happens, you can debug it. Make a copy of the source code and store it somewhere out of the way. Then start hacking the source code. Make it smaller/simpler while you check if the problem continues to exist. If you have 15 choices somewhere, 2 are sufficient, etc. At some point the problem will go away. Then you know the crucial change was in the edits that you did since the last test. Eventually, you will find the edit that makes the problem disappear. At that point, try to understand why the behavior changes (computer use rules for deciding something, understand that rule).
Once you understand the rule, go back to your stored copy (and make a copy of your copy, just in case the fix doesn't work out as you expect), and fix the problem.
Another way is to get external help, like here at the forum, or at the #openttd IRC channel. You will need to supply the source code, so others can read it, look for errors, or even debug it like described above. Generally, you'll get pointed to the problem spot, so you can fix it.