Why the Run button breaks trigger handlers
When you click Run (or press Ctrl+R) in the Apps Script editor, it calls your function with zero arguments. For a normal utility function that is fine. For an event-driven handler like onEdit, onFormSubmit, or onSelectionChange, the first parameter is an event object the Sheets runtime constructs and passes automatically — it contains range, value, oldValue, source, and a few other fields depending on the trigger type.
Run in the editor provides none of that. The parameter e arrives as undefined, so the first line that touches e.range (or e.value, or e.namedValues) throws 'Cannot read properties of undefined'. The function is not broken. The launch method is wrong.