Skip to content

fix(cron): guard against null deliver/repeat/schedule in cron list#32916

Open
annguyenNous wants to merge 1 commit into
NousResearch:mainfrom
annguyenNous:fix/cron-list-null-fields
Open

fix(cron): guard against null deliver/repeat/schedule in cron list#32916
annguyenNous wants to merge 1 commit into
NousResearch:mainfrom
annguyenNous:fix/cron-list-null-fields

Conversation

@annguyenNous

Copy link
Copy Markdown
Contributor

Fixes #32896

When a cron job has null deliver, repeat, or schedule fields (common when jobs are created without explicit delivery), hermes cron list crashes with:

TypeError: can only join an iterable

Root Cause

.get("key", default) only applies the default when the key is missing. When the key exists with value None (null in JSON), .get() returns None and the default is ignored.

Fix

Use or default pattern instead of .get(key, default):

  • job.get("deliver", ["local"])job.get("deliver") or ["local"]
  • job.get("repeat", {})job.get("repeat") or {}
  • job.get("schedule_display", ...)job.get("schedule_display") or (...)

This ensures None values are also replaced with the default.

Changes

  • hermes_cli/cron.py: 3 lines changed

When a cron job has null deliver, repeat, or schedule fields
(common when jobs are created without explicit delivery),
hermes cron list crashes with TypeError:
  can only join an iterable
  'NoneType' object has no attribute 'get'

Fix by using `or {}` / `or []` pattern instead of .get(key, default)
which only applies the default when key is missing, not when
key exists with null value.

Fixes NousResearch#32896
@mohamedorigami-jpg

Copy link
Copy Markdown
Contributor

Clean fix. I hit the same null deliver field crash on my instance (#32896 is the same root) -- the job.get('deliver') returning None instead of defaulting to ['local'] is the core issue. Using 'or ['local']' instead of 'get(..., ['local'])' is the right call here because get() with a mutable default is a pitfall (the default gets shared across calls). Same pattern on repeat_info and schedule_display.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cron Cron scheduler and job management comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists labels May 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #20264 (canonical fix for null fields in cron list). Superset of #23490 (null repeat only) and overlaps #28771. Fixes #32896.

@mohamedorigami-jpg

Copy link
Copy Markdown
Contributor

Closing as duplicate of #20264 as flagged. #20264's approach (using or {} / or [local]) also covers schedule and deliver fields, not just repeat — worth adding those too for completeness.

@mohamedorigami-jpg

Copy link
Copy Markdown
Contributor

Superseded by #20264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: hermes cron list crashes when job has null deliver field

3 participants