If you're trying to change a habit, the first time you break the chain you may feel as if you've failed. Stay flexible to get back and keep the habit going.
Photo by Dave Rosenblum
Instead of seeing this as a failure, acknowledge that your habit changes aren't absolute and slipping up isn't a failure. Zen Habits explains:
The problem isn't the event that derailed us, that caused our perfect habit to go bad … the problem is our ideal about how the change will go. The ideal is just a fantasy, made up in our heads. It's not real. It's not realistic.
What's more realistic? Reality. Instead of holding onto the fantasy you have about the change, let that go and embrace the reality of the change. Be open to whatever happens, be curious what it's like, and actually be present and observe the change as it happens.
Even with lifelong habits, we all make mistakes. You can't expect perfection -- especially with a habit you want to change. Each time you make the mistake and learn from it, you'll reinforce the habit for the future.
How to Stop Your Habit Changes From Getting Derailed [Zen Habits]