This sounds like burnout to me. I am in my mid-40s and used to have spells like this, but no more. I needed some kind of large change, back then, to get myself sorted out, but this could be pretty destructive because if I waited too long, the change I'd need wouldn't really be conducive to staying on whatever project I was on.
The key to not having to deal with this problem anymore, for me, was starting to proactively switch things around to break the routine of consecutive work-weeks. One of my tricks was to do some kind of mini-vacation every 6-8 weeks, go somewhere new, leave work behind for 3-4 days. Even smaller things like regular social events can work wonders - anything that breaks the weekly routine.
Back when I'd get myself into burnout periods the most effective way to recover enthusiasm was to pick up a new skill, work-related or not. I was in my mid-30s in the late aughts and not entirely sure I wanted to keep coding - so I signed myself up for an 18 month "executive MBA" program to find out if I might want to do something else, and instead came out of that with a whole new outlook on how and why to write code.
Then around 5 years later I started writing code on the side, for myself, to gradually improve over the long term, and this can be absolutely therapeutic.
Try to switch things around a little bit, do something new, see if that helps?
The key to not having to deal with this problem anymore, for me, was starting to proactively switch things around to break the routine of consecutive work-weeks. One of my tricks was to do some kind of mini-vacation every 6-8 weeks, go somewhere new, leave work behind for 3-4 days. Even smaller things like regular social events can work wonders - anything that breaks the weekly routine.
Back when I'd get myself into burnout periods the most effective way to recover enthusiasm was to pick up a new skill, work-related or not. I was in my mid-30s in the late aughts and not entirely sure I wanted to keep coding - so I signed myself up for an 18 month "executive MBA" program to find out if I might want to do something else, and instead came out of that with a whole new outlook on how and why to write code.
Then around 5 years later I started writing code on the side, for myself, to gradually improve over the long term, and this can be absolutely therapeutic.
Try to switch things around a little bit, do something new, see if that helps?