An error occurred while moving messages to mailbox “(null)”
Try selecting the Trash mailbox (folder) and then the menu item:
Mailbox → Use This Mailbox As → Trash Mailbox
If this is occurring with a Gmail IMAP account:
This problem occurred for me because my Trash
label in gmail was not set to 'show in IMAP' (despite following the recommendation of @rcarver). I required one additional step first, i.e.
In Gmail settings, make sure that the trash label is set to 'show' and 'Show in IMAP'.
In Mail.app, select the trash folder, Mailbox → Use This Mailbox As → Trash Mailbox.
[see @rcarver's answer above]