Redirect to existing query when creating a duplicate

Also fix the flash message to explain why the query couldn't be created
in this case.