Portsnap – Corrupt Snapshot

I ran into a problem with portsnap on my FreeBSD box and just figured out how to fix it. There was little information on the problem online so I will share it in case anyone else encounters this problem:

/usr/ports/files/<hash>.gz not found — snapshot corrupt.

To fix it I did this as root:

rm -rf /var/db/portsnap/*
portsnap fetch
portsnap extract update

This removes the corrupt snapshot database and forces it to fetch an entirely new one, then continue the update as usual.