Boredom
Happiness is a vague word.
The opposite of happiness is much easier to define. It's boredom.
In the hacker world, there's an implicit rule: never do boring things.
Boredom has two meanings. First is stagnation. Second is unexciting.
Being stuck at something unexciting.
How to avoid being stuck? Optionality. Emergency fund. Mastering universal demanded skills. Etc.
But more importantly, to avoid being stuck you need to eliminate hollow desires, the desire to have too many desires. Irrational fears.
The "unexciting" part is subjective and objective at the same time. Some things are unexciting as hell. Some things are universally more exciting.
Don't get trapped doing shit that drains you.
Build the ability to walk away. Then choose what's actually worth doing.