Nightmares and vivid dreams of conflict and failure are common enough for us at the beginning.
What I use as a remedy is to wake up and, with the lights on, think clealy about what the nightmare was about. If it's about finances, then I may open my budget spreadsheet to prove to myself that my plans are good. If it was about coming out to family, I would review what my coming out letter said, and maybe tweak it a bit. If it was work-related I'd review my plans and see whether they needed any changes.
Above all, WAKE UP FULLY, and once you are awake, clear your mind properly so that you do not go around in circles the whold night.
Hugs
Julia