The Sufficiently Advanced Aliens are not pleased. The human race has been warring, polluting, nuclear-bombing, and not looking both ways before crossing the street. So now, they've come to put Humanity On Trial.
This usually involves plucking out a certain person or group of people - coincidentally, our protagonists - and putting them in a metaphorical court, to testify on behalf of the human race. Sometimes, there are individuals plucked from all ages of humanity's past (with the usual Time Travel cliches in effect).
Sometimes, it's stated that this is happening because we're on the brink of traveling out into space, or because we've just discovered nuclear power, but often the Powers That Be have just decided it is time. This is very peculiar if other species (or even the one doing the accusing) do the exact same thing in similar circumstances.
The hypocrisy of wiping out a species because it suits them is rarely addressed. If it is, it's justified with Humans Are Bastards, the only sentient race in the whole universe that does dirty things like cheating, lying, murdering, etc. The accusing aliens may have long ago overcome such behaviors, but they may even drop the bombshell that they never suffered from them in the first place, and have always been a utopian, perfect race that never as much as littered. The accuser also ignores the oddity of punishing an entire species for crimes against itself.
This is one of The Oldest Ones In The Book; the alien versions derive from Christian God/Devil versions, going back all the way to the Book of Job and the story of Noah (a good example of what happens when humanity doesn't measure up).
Sometimes an "act of self-sacrifice" by one of the protagonists will "prove" that humanity deserves to exist. If the aliens didn't know that this was possible, then they really Did Not Do The Research.
If the plot has humanity not playing along and actually fighting back, then the accusers often downgrade to Scary Dogmatic Aliens. Otherwise, the verdict is usually that Humans Are Special (occasionally, the accusers actually suspected this all along, and just wanted to make sure we live up to our potential). Then again, considering all the criminally irresponsible "parenting" some Neglectful Precursors do, one wonders why they aren't on trial.