I experienced this alarming event today for the first time in exactly five months of ownership. Indeed it seems in preparing to go out, I had not closed the hatch hard enough, although close enough to not trigger the gate open alert on the display.
A quick return to the driveway and google "key detected in vehicle" while still in the turned off vehicle, got us the answer. Just one final excitement, apparently it did become locked/armed, so when I hopped out to open/close the tailgate, I promptly set off the alarm...
Will know for next time, but the first time with flashing yellow [!], alert tones, flashers blinking, door locks locking/unlocking and "Key detected in vehicle" certainly triggers anxiety and confusion. Even detected some fumes which added to the concern about the flashing yellow [!], but now realize that was probably cold start exhaust being drawn into the slightly ajar tailgate.
This "not quite latched" tailgate issue seems to confuse the software into thinking we are trying to lock our keys inside the vehicle...