I tried enrolling for a class via my.harvard and I received an error saying the class was not valid.

Try removing the course from your Crimson Cart and then re-add it.  Sometimes there are changes to the course set-up that need to be recaptured.