Throw error when specified method does not exist

Fixes #247.

I am not sure if #9983660 is related to the issue.