Diagnosis
The door latch assembly is worn or misaligned. The primary latch switch isn't being engaged, so the safety interlock system prevents operation.
How to Fix It
Unplug the microwave. Inspect the plastic hooks on the door and the corresponding latch mechanism on the cabinet. Look for broken plastic or worn parts. The entire latch assembly (part number often WB27X10020) may need replacement.
If That Didn't Work
The three interlock switches (primary, secondary, and monitor) behind the latch can fail. A technician can test them for continuity when the door is closed.
Heads Up
Never attempt to defeat or bypass the door switches. Microwaves must not operate with the door open due to radiation exposure. If the door is loose, replace the parts. It's a safety-critical repair.