Fix error reporting for invalid object key.
Merge pull request #2925 from marchaefner/master

Fix error reporting for invalid object key.