{"record":{"id":"26e049b5c41aa4e6","repo":"NousResearch/hermes-agent","slug":"cron-database-corrupted-expected-jobs","errorCode":null,"errorMessage":"Cron database corrupted: expected {'jobs': [...]}, got {type(data).__name__}","messagePattern":"Cron database corrupted: expected (.+?), got (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"cron/jobs.py","lineNumber":1120,"sourceCode":"    # down the whole cron subsystem.\n    if isinstance(data, dict):\n        jobs = data.get(\"jobs\", [])\n        if _strict_retry and jobs:\n            # Hit control-character corruption — rewrite with proper escaping.\n            save_jobs(jobs)\n            logger.warning(\"Auto-repaired jobs.json (had invalid control characters)\")\n        _record_load_stamp(pre_read_stamp)\n        return jobs\n    if isinstance(data, list):\n        # Bare array — likely saved/edited outside save_jobs(). Wrap it back\n        # into the expected {\"jobs\": [...]} structure.\n        if data:\n            save_jobs(data)\n            logger.warning(\"Auto-repaired jobs.json (bare list wrapped as dict)\")\n        _record_load_stamp(pre_read_stamp)\n        return data\n\n    raise RuntimeError(\n        f\"Cron database corrupted: expected {{'jobs': [...]}}, got {type(data).__name__}\"\n    )\n\n\ndef _peek_jobs_unlocked() -> Optional[List[Dict[str, Any]]]:\n    \"\"\"Best-effort read of on-disk jobs without repair side-effects.\n\n    Caller must hold ``_jobs_lock()``. Returns ``[]`` when the file is\n    missing, ``None`` when the payload is unreadable/corrupt (caller should\n    not attempt a shrink-merge against an unknown baseline). Never calls\n    ``save_jobs`` — the repair-free property is what keeps the save path\n    re-entrancy-safe (a repairing read here would recurse through\n    ``_save_jobs_unlocked``).\n    \"\"\"\n    jobs_file = _current_cron_store().jobs_file\n    if not jobs_file.exists():\n        return []\n    try:","sourceCodeStart":1102,"sourceCodeEnd":1138,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/cron/jobs.py#L1102-L1138","documentation":"Error \"Cron database corrupted: expected {'jobs': [...]}, got {type(data).__name__}\" thrown in NousResearch/hermes-agent.","triggerScenarios":"Thrown at cron/jobs.py:1120 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restore the cron database from backup; its top-level shape is invalid.","Delete the corrupted database and recreate jobs."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}