search: fix RuntimeError: No active exception