“Out of nowhere” ending or an ending that is just waking up from a dream


I recently heard someone use a phrase or word to describe the situation where an author uses an extraordinary, fantastical, and/or irrational ending to conclude a story instead of addressing and solving the conflicts introduced along the way. I think this phrase may also apply when the author ends the story by saying it was “all a dream.” I’d like to know what this is called. Does anyone here know what I’m talking about?

Answered question

If it is stated by the end that “it was “all a dream” it means that now the author has made his protagonist of the story to wake up. It also could be a moment of recognition. Hence, it is an epiphany. If you do not agree, please elaborate your question.

Answered question