emacs -Q --eval "(setq default-frame-alist '((minibuffer . nil)))" --eval
(quail-define-package "Agda" "UTF-8" "A" t)'
C-u C-\ agda RET
M-%
and I get the appended backtrace. As the input method name explains,
I bump into this problem when I use Agda (i.e. pretty often these days).
Is it possible that the frame switched to (0x8c793d8 at #13) is deleted?
AFAIK no frame is deleted in the above scenario, and the frame's
`terminal' field is not NULL (if that's what you were asking).
0x8c793d8 is the minibuffer-only frame.
IIUC your question, you can't reproduce it on your end?