diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index dfda561433a0..3ea40c7a1e18 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -8569,6 +8569,9 @@ def _serialize(self, id_encoder, serialization_options): def to_dict(self, view="collection", value_mapper=None, step_details=False, legacy_job_state=False): rval = super().to_dict(view=view, value_mapper=value_mapper) + if rval["state"] is None: + # bugs could result in no state being set + rval["state"] = self.states.FAILED if view == "element": steps = [] for step in self.steps: