Never take a role which you're not excited to perform. Excitement about future prospects doesn't count.
This advice can be broken down into roughly three imperatives that all try to capture the same thing. First, don't apply to roles that don't excite you. Early on, when you're still trying to figure out what it is you want to do and what jobs are out there, this will seem impossible. The best way to combat this is to take advantage of the infectiousness of excitement; for roles that you think you are interested in or roles that you are eligible for, try talking to at least one person in that role. The more similar this person is to you, the more infectious their excitement will be. If you're in school, try to find a recent graduate. If you're coming from an atypical background, try to find someone with a similar background or just some other atypical background. Your goal is to get a sense of what excites this person about the role and see if that, in turn, excites you. If you're still not excited, consider a new field of work.
If nothing seems appealing, as is often the case, step back to think about which activities most easily drop you into a sense of focus or "flow", that feeling where you are totally committed to working on something, where stress and a sense of time kind of fall away to a sense of alertness. Don't confuse this with having fun or feeling joy, you're unlikely to find a sense of flow hanging out with friends or watching TV. Again resolve to try and talk to someone making a living doing that thing to see if that excites you. Eventually you'll find something that excites you.
Second, don't sacrifice excitement about the current role for the prospect of a future role, this is one of the most surefire paths to misery. The characteristic thought pattern here is something along the lines of, "Yeah, this isn't really my top choice but I think it's fine and in 2 years, I should be able to pivot to X." Taking a role under this pretense sets you up for a lot of anxiety around performance with none of the intrinsic motivation required to perform at your best. Starting down this path is a slippery slope as 2 years down the line you will find yourself making the same choice, and 2 years after that, making it again. Each sacrifice for the future compounding your misery in the present. Focus on the present and let the future come to you.
Finally, really bask in the sense of gratitude and accomplishment that comes from receiving an offer. Let yourself be excited, don't trivialize the achievement. Too often, we whittle away that sense of excitement by immediately considering downsides, weighing the next moves before we've taken this one. Even a brief moment to breathe a sigh of relief and internally celebrate the accomplishment can have a profound effect. Be grateful, be excited! You've earned it. Sometimes, it can be enough to just be excited about landing a job. For the entire year between accepting a job in consulting and starting, I remember having a great sense of excitement, perhaps mostly driven by a sense of relief. I would often get questions I thought completely irrelevant such as, "What does one do in consulting?" or, "What are you consulting for?" Of course I hadn't the faintest clue to the answers but boy was I excited.