Use custom TerminatedError type for sandbox_filter