VIAF contains GND entries, and the IDs listed there are usually the GND IDs themselves. However, some GND IDs contain hyphens, and those are replaced by numeric IDs usually starting with a 0 or a 9.
Those are not GND IDs. Your bot is importing those invalid ones from MusicBrainz. (e.g. see Special:Diff/1483617303) They do not match the regular expression. The easiest approach would be to ignore them and maybe list them somewhere to fix them here and in MusicBrainz.
Another more advanced and complex approach would be to check for a VIAF processed entry and extract the correct ID, that is in there.