Failed my professor months ago, not sure what to do now About 8 months ago I was about to graduate university and was trying to figure out what to do with myself then. A professor asked me if I wanted to do  my masters with him and I said yes almost without thinking.

I still had classes at that moment so for about a month and a half I focused on my courses and he did not talk to me so there was little communication between the two. Due to an error in the system, my application for a masters program got delayed to January this year, rather than July, when it was originally planned by both me and the professor. I was taking 2 highly accelerated courses, one of which was a grad course, so I in between the stress and my own ignorance I neglected dealing with that issue until it was too late.

I had an immigration status that made it so that I needed to get a job within 90 days of graduating or I would be kicked out of the country. Without talking to my professor I panicked and applied to jobs, got one and then "remembered" to tell my professor essentially a week before moving to a different city to start my job. 

In other words, I told him I would work with him and then didn't communicate anything to him and then a month after went back on my word and left for a job.

This professor is the person with whom I did my undergrad thesis, so he is invaluable as a recommendation reference. But I don't think I deserve or have any right to ask him for references. Worse than that, even if I was shameless enough to ask, it is unlikely he would give me a good reference after I essentially shat on a verbal agreement and betrayed his trust by unilaterally taking fast decisions without telling him anything.

Is there anything I can do here? I messed up, I messed up horribly, but I still want to go to grad school even if at this point I probably don't deserve it.
I think you are being a little bit too hard on yourself. That said, you acted unprofessionally and were irresponsible in communicating with the professor. The prof may feel like you treated him with a lack of respect, so it is important to make it clear that you do respect him, and that your behavior was selfish and childish.

The best course of action is to come clean. 


Write an email or schedule a call with the professor. 
Apologize for behaving unprofessionally. 
Do NOT make excuses. You can mention that you couldn't have started the masters program because of visa issues, but you should have told him as soon as you discovered that information. Remember, what you did wrong was fail to communicate. Not starting the masters is not the "crime". 
Acknowledge that your behavior was unprofessional. 
Thank them for their mentorship over the years. Take some time to think about what you learned from them and let them know. This demonstrates your maturity and shows that you respect and appreciate him.
Apologize again and mention that you hope that you haven't ruined the relationship.


Assuming the professor is a reasonable adult, they will accept your apology, and you may ask for a reference in the future.