Whether or not to be a generalist is a question of ambition and also where you are in your career. Life outcomes for generalists cluster around the median, outcomes for specialists have much higher variance. The idea of "t-shaped skills"[0] is valid and often excellent generic advice for optimizing career outcomes but it is not the right advice for everyone. I made a very intentional decision to ignore my polymath instincts and focus on just a few strategic areas when I was ~30 and it made a very noticeable difference in terms of the opportunities available to me.
It is difficult to know what you want to specialize in without generalizing first. True mastery of a domain typically requires considerable amounts of personal interest and focus, so it needs to be something you enjoy or you are unlikely to be competitive against those who do enjoy it.
An alternative, if a single specialization feels too limiting, is skill stacking i.e. specializing in two or three skills. This has more potential but requires more work. There may be only a few people in the world that can operate at the intersection of those specializations -- it can be very rewarding depending on what those specializations are. Complementary specializations can be synergistic.
Don't discount specialization happening accidentally by virtue of how your career evolves. I have a useful deep specialization that I never intended which is strictly an artifact of a truly random path dependency, not personal interest. Nonetheless, it is immensely valuable to me now because it complements other specializations I have so I maintain it.
Don't worry about it. If something is worth going deep in, you won't need anyone to tell you.