The perspective changes if you're in your last year of PhD as GP said. I'm sure the system is built in a way that you'll still graduate because your supervisor knows this is about learning how to conduct research and not about being right. But it's likely still soul crushing to come out with no published paper (unless you still publish knowing you're wrong, which in some cases might be valuable).
If your soul can bounce back, finding ways your previous research might help, or combine with the breakthrough (or not !) can help. I've used many previous formal/analytic SOTA algorithms and methods for dataset tagging automation, or as feedback for RL, or to speed-up post-training.
Three/four years of (honest) work is usually worth to publish. The result might not be high impact (and thus end up in a lower tier journal, sadly) but knowing what didn't work is also a valid output.