You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
load_jobs() raises uncaught AttributeError on non-dict jobs.json, taking down the entire cron subsystem #36867
If cron/jobs.json has a top-level JSON value that isn't an object (e.g. a bare array [...]), load_jobs() throws an uncaught AttributeError: 'list' object has no attribute 'get'. Because every cron code path goes through load_jobs(), this takes down the entire cron subsystem — the scheduler tick can't load any jobs, and the cronjob agent tool fails on every call — until the file is repaired by hand.
withopen(JOBS_FILE, 'r', encoding='utf-8') asf:
data=json.load(f)
returndata.get("jobs", []) # <-- AttributeError if data is a list, not a dict
The try only catches json.JSONDecodeError and IOError. A bare-list file is valid JSON, so json.load() succeeds and the .get() raises AttributeError, which propagates uncaught out of load_jobs(). The existing strict=False auto-repair path only handles control-character JSONDecodeError, not a wrong top-level shape.
Impact
Scheduler tick raises every cycle → no jobs run.
cronjob agent tool returns {"error": "'list' object has no attribute 'get'", "success": false} on list/add/edit → bot appears unable to create or modify schedules.
Fails closed and silently; requires manual file surgery to recover.
How it happens in practice
A jobs.json saved/edited outside save_jobs() (e.g. an admin editing it directly, an external tool, or a botched migration) can end up as a bare array instead of the expected {"jobs": [...], "updated_at": ...} wrapper. Distinct from #34600 / #32164, which are about the file being cleared/deleted rather than mis-shaped.
Suggested fix
Guard the shape and fold it into the existing repair/raise handling — accept a bare list as the jobs array (auto-repair by re-wrapping via save_jobs), and raise the graceful RuntimeError("Cron database corrupted...") for any other non-dict:
data=json.load(f)
ifisinstance(data, list): # tolerate/repair legacy or externally-written bare arraysave_jobs(data)
logger.warning("Auto-repaired jobs.json (top-level was a list, expected object)")
returndataifnotisinstance(data, dict):
raiseRuntimeError(f"Cron database corrupted: top-level is {type(data).__name__}, expected object")
returndata.get("jobs", [])
Activity
Uraxii commentedon Jun 1, 2026
Pipeline fix opened: #36982
Summary:
Verified:
— architect-designer / architect
fix(cron): handle non-dict jobs.json gracefully instead of crashing N…
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe
fix: batch of small robustness/correctness fixes from @kyssta-exe