I think it's a bug. I've seen it on another project I wasn't working on and one just now that I am.
I think the problem stems from a Grid-within-a-relationship or vice-versa. I fixed the first way by splitting the tag into an embed (and passing entry_ids into it), but on my project I had to update the core files, which I hate.
If you ever HAVE TO update core code, I always recommend commenting with a universal token "MYCOMPANYNAME_DEV" so they can be searched for before an upgrade, along with your initials, date, and a description of what you've done (and wherever possible, keep the old code commented out).
I updated the lineToCharacterOffsets method in the VariableFinder.php file, found in /system/expressionengine/libraries/relationship_parser
The line before:
if ($str[$offset] == "\n") {
put this:
if ($offset > strlen($str)) {
$offset = strlen($str);
break;
}
It's looking for a linebreak beyond the scope of the string (a string being just an array of char), so I just give it the end of the string and tell it to move on. It seems to do the trick, but hopefully this will be picked up and remedied soon.