... and they all lived unhappily ever after.
There was a time in my writing career when, by both choice and compulsion, I wasn't capable of writing anything but a happy ending. I killed off a character in a novel, only to suddenly find myself stumbling across a way to resurrect him. I took a short story class and was asked to write a story with an unhappy ending. When the instructor read it, he commented that the characters weren't very sympathetic.
Well, of course, I thought. Who would want to read about sympathetic characters failing?
Over the years, I've slowly relaxed my position on unhappy endings, though I'm more prone to bittersweet, and the "yes, but ..." is still my favorite ending. I suppose in most cases, my bittersweet *is* a "yes, but ...": the character gets what they want, but at a high price, or they find that it wasn't what they wanted, after all. I can't give examples without spoilers, of course.
For me, there's an emotional toll quota in a story. I don't want to read a depressing story with a depressing ending - I just feel wrung out and unsatisfied. To "earn" an unhappy ending, the story has to have enough hope and levity that the reader doesn't enter the last paragraphs already exhausted. Conversely, you can batter the character with unrelenting darkness ... if there's light at the end of the tunnel.
I think the first time I wrote what I'd call a bittersweet element in an ending was in The Sintellyn Medallion. There were multiple romantic attractions in the story; some of them were mutually exclusive as far as happy endings might go. One of them was a mutual attraction that broke off because one character had to choose between career and romance - that's another theme and strongly held belief of mine. In any case, it doesn't end well for everyone, and there's several wistful notes in the concluding chapter.
Since then, I've dabbled further ... but I still find that my instinct is for a happy ending. I can't remember which story it was any more, but I'd planned a hope-is-lost sort of ending ... and as I approached writing it, I realized that it wanted to keep going, and that another half page completely changed the tone of the ending. So I suppose I'm still resurrecting the dead, moving heaven and earth to give my characters success ...
... but at what cost?