diff --git a/petab/v2/lint.py b/petab/v2/lint.py index 178abc79..1fe83144 100644 --- a/petab/v2/lint.py +++ b/petab/v2/lint.py @@ -768,8 +768,15 @@ def run(self, problem: Problem) -> ValidationIssue | None: if condition_id in valid_conditions: continue - # we assume that all referenced condition IDs are valid - condition = id_to_condition[condition_id] + try: + condition = id_to_condition[condition_id] + except KeyError: + messages.append( + f"Unable to validate changes for condition " + f"{condition_id} applied at the start of " + f"experiment {experiment.id}, as the condition " + "does not exist." + ) used_symbols = { str(sym)