For spells with multiple attack rolls, what happens if there are no targets left?


When are targets picked for spells with multiple "missiles"? tells us that you can (probably) resolve each “beam” or “ray” of, say, eldritch blast or scorching ray one after the other.

Assuming this is true, what happens in the following scenario:

  • One enemy left, has low HP;
  • PC casts one of the aforementioned spells and hits with their first “beam”/”ray”;
  • First beam kills that enemy (to revolve any ambiguity about enemy death saving throws, let’s assume the PC rolls maximum damage and it kills the enemy outright by exceeding it’s maximum HP; 1d10 or 2d6 could certainly do this to a goblin on less than half health);
  • What happens to any remaining beams?

Eldritch blast says:

A beam of crackling energy streaks toward a creature within range.

And scorching ray says:

You create three rays of fire and hurl them at targets within range. You can hurl them at one target or several.

Can you choose to not fire any remaining “beams”/”rays”? Can you just fire them at the floor (seems unlikely for eldritch blast since you can only target a creature)? Can you continue firing at the dead enemy anyway (again, unlikely for eldritch blast, since a corpse is not a creature)? Do you have to fire at an ally, or whoever the nearest creature is (for eldritch blast, at least)?