Throw better error in renameTask if task doesn't exist

Fixes #1057