-
-
Notifications
You must be signed in to change notification settings - Fork 52.8k
Description
Summary
Cron jobs created via an earlier version of OpenClaw store the schedule expression as "cron": "..." in jobs.json. The current scheduler expects "expr": "...". When the scheduler tries to compute the next run time, it throws:
TypeError: Cannot read properties of undefined (reading 'trim')
This silently prevents all affected jobs from ever firing. The error is stored in state.lastError as "schedule error: TypeError: Cannot read properties of undefined (reading 'trim')" but nothing alerts the user.
Suggested fix
In service/store.ts ensureLoaded(), add migration: if sched.cron is a string and sched.expr is missing, set sched.expr = sched.cron and delete sched.cron.
Additional context
Also affects: jobId field (schema expects id) and missing wakeMode. No active monitoring alerts the user when scheduler errors occur — the failure is completely silent.
Steps to reproduce
- Have a jobs.json with schedule: { kind: "cron", cron: "20 6 * * *", tz: "..." }
- Start the gateway
- Scheduled jobs never fire; state.scheduleErrorCount increments silently
Expected behavior
Either: (a) the store migration in service/store.ts ensureLoaded() renames cron → expr automatically, OR (b) computeNextRunAtMs() in schedule.ts guards against schedule.expr being undefined instead of calling .trim() directly.
Actual behavior
silent failure
OpenClaw version
2026.2.21
Operating system
Ubuntu on docker
Install method
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response