NousResearch/hermes-agent · error · RuntimeError

Cron database corrupted and unrepairable: {e}

Error message

Cron database corrupted and unrepairable: {e}

What it means

Error "Cron database corrupted and unrepairable: {e}" thrown in NousResearch/hermes-agent.

Source

Thrown at cron/jobs.py:1097

    """Load all jobs from storage."""
    jobs_file = _current_cron_store().jobs_file
    ensure_dirs()
    # Stamp BEFORE reading (fail-safe direction — see _record_load_stamp):
    # a sibling write racing this load leaves the stamp older than disk, so
    # the save-path merge runs instead of being wrongly skipped.
    pre_read_stamp = _jobs_file_stamp(jobs_file)
    if not jobs_file.exists():
        _record_load_stamp(None)
        return []

    try:
        data, _strict_retry = _parse_jobs_file(jobs_file)
    except IOError as e:
        logger.error("IOError reading jobs.json: %s", e)
        raise RuntimeError(f"Failed to read cron database: {e}") from e
    except Exception as e:
        logger.error("Failed to auto-repair jobs.json: %s", e)
        raise RuntimeError(f"Cron database corrupted and unrepairable: {e}") from e

    # Validate the top-level JSON shape: accept a dict (expected) or a bare
    # list (auto-repair). Anything else (str/number/null) is corruption that
    # would otherwise raise an uncaught AttributeError on ``.get()`` and take
    # down the whole cron subsystem.
    if isinstance(data, dict):
        jobs = data.get("jobs", [])
        if _strict_retry and jobs:
            # Hit control-character corruption — rewrite with proper escaping.
            save_jobs(jobs)
            logger.warning("Auto-repaired jobs.json (had invalid control characters)")
        _record_load_stamp(pre_read_stamp)
        return jobs
    if isinstance(data, list):
        # Bare array — likely saved/edited outside save_jobs(). Wrap it back
        # into the expected {"jobs": [...]} structure.
        if data:
            save_jobs(data)

View on GitHub (pinned to c896c09c42)

Solutions

  1. Restore the cron database from a backup, or remove it to start fresh (losing jobs).
  2. Report the corruption if it recurs after recreation.

When it happens

Trigger: Thrown at cron/jobs.py:1097 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/9eb3f2fcbdb67c2f. Report an issue: GitHub.