Create a test script like:
throw new coding_exception('Oops', new stdClass());
when you run it, you should be able to see that the error was caused by line 3 of test.php.
See the comments on MDL-23884 where currently the error messages are very unhelpful. With this one-line change, the error is triggered in a place where the stack-trace is much more helpful.
has been marked as being related by
MDL-33548Quiz comment.php fails to validate the grade that was input, leading to a weird error.