This is related to #1011, we should review it again if we decide that our API should throw runtime exceptions.