Go To Related Record can return a number of different error codes for failure scenarios (100 for missing file, 106 for missing table occurrence, 103 for unrelated table occurrence, 105 for missing layout, etc.), but when GTRR fails because of an unindexed field in the relationship, FMP only gives an error message (unskippable even with Error Capture on) and returns an error code of 0; the script then proceeds from there. This could dump my script into a dangerous context if it's unaware anything went wrong.
A workaround, of course, is not attempting the GTRR without checking for the presence of related records (which I understand is a best practice in general). I just don't understand why GTRR would give error codes for all failures except this one specific type. Is this intended behavior?