It works for me but does fail if I add a space before or after "errored" in the file. Extra text will show up in the output, but the spaces do not. Maybe that's it?
You're right in this case because there was an extra space on the line that was picked up by grep, but it should work as long as there are no extra spaces or text. He was echoing the line, which should show anything extra picked up by grep, but it didn't because echo is picky when it comes to unquoted variables.
I learned it the hard way, always use echo "$var" not echo $var