From c4674cbe211006e912b76533163eac8735801ea9 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 15 Apr 2026 14:25:12 -0700 Subject: [PATCH] fix: parse string schedules in cron update_job() (#10129) (#10521) update_job() assumed the schedule value was always a pre-parsed dict and called .get() on it directly. When the API passes a raw string like "every 10m", this crashed with AttributeError. The create path already handles this correctly by calling parse_schedule() on the incoming string. The fix adds the same normalization to the update path: if the schedule is a string, parse it into a dict before proceeding. Closes #10129 --- cron/jobs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cron/jobs.py b/cron/jobs.py index 47e0b66ef..06d782888 100644 --- a/cron/jobs.py +++ b/cron/jobs.py @@ -501,6 +501,12 @@ def update_job(job_id: str, updates: Dict[str, Any]) -> Optional[Dict[str, Any]] if schedule_changed: updated_schedule = updated["schedule"] + # The API may pass schedule as a raw string (e.g. "every 10m") + # instead of a pre-parsed dict. Normalize it the same way + # create_job() does so downstream code can call .get() safely. + if isinstance(updated_schedule, str): + updated_schedule = parse_schedule(updated_schedule) + updated["schedule"] = updated_schedule updated["schedule_display"] = updates.get( "schedule_display", updated_schedule.get("display", updated.get("schedule_display")),