diff --git a/airflow/www/views.py b/airflow/www/views.py index 8be5bb1ed101b..bd4efb211caf8 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -2287,7 +2287,11 @@ def _clear_dag_tis( except AirflowException as ex: return redirect_or_json(origin, msg=str(ex), status="error", status_code=500) - assert isinstance(tis, collections.abc.Iterable) + if not isinstance(tis, collections.abc.Iterable): + raise AssertionError( + f"Expected dag.clear() to return an iterable for dry runs, got {tis} instead." + ) + details = [str(t) for t in tis] if not details: