Skip to content

Scheduler crash and UI failure when tasks.json contains invalid cron or malformed task entry #1264

@Richimico

Description

@Richimico

I ran into a scheduler corruption issue severe enough to make the whole UI unstable.

Context

Docker deployment of Agent Zero.

The application became partially unusable: prompts could no longer be sent reliably, the scheduler disappeared, restore attempts failed, and the UI websocket kept disconnecting.

What happened

The root cause was a malformed entry in:

/a0/usr/scheduler/tasks.json

At least one task had this invalid weekday value:

"weekday": "*1-5" This leads to: ValueError: invalid range specifier: '*1' ('*1-5') I also found that the same tasks.json had additional malformed content, including broken JSON fragments such as missing commas and damaged keys/values. Observed behavior Once that malformed task existed, Agent Zero did not isolate the bad entry. Instead, the scheduler loop crashed repeatedly, and UI state serialization also started failing because task metadata such as next_run could no longer be computed. As a result, the following symptoms appeared: the scheduler became unusable the interface became unstable prompt submission was affected restore / backup-related actions also became unreliable Expected behavior A malformed scheduled task should not be able to break the whole application. What would help: Validate cron fields before writing task data Validate JSON before persisting tasks.json Quarantine or ignore invalid task entries at load time Keep the UI functional even if one scheduler task is invalid Recovery The issue was resolved by backing up the broken scheduler file, replacing it with a clean empty scheduler, and restarting the container: docker exec -it agent-zero bash cp /a0/usr/scheduler/tasks.json /a0/usr/scheduler/tasks.json.broken_20260315 printf '%s\n' '{"tasks":[]}' > /a0/usr/scheduler/tasks.json exit docker restart agent-zero After that, the UI and scheduler returned to normal immediately. Additional note I also had a couple of stale old project folders in /a0/usr/projects, but those were secondary. The real blocking issue was the malformed scheduler file. Hope that his helps! Best, Richimico

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions