Skip to content

[Bug]: hermes cron list crashes with TypeError: can only join an iterable when any job has deliver: null #41392

Closed as not planned

Description

@nujovich

Bug Description

hermes cron list raises an unhandled TypeError and lists no jobs if any job in jobs.json has deliver: null. cron.py:95 does ", ".join(deliver) assuming deliver is always an iterable of targets, but None is a valid stored value (jobs created without a delivery target persist deliver: null). One such job makes the entire cron list command unusable.

Steps to Reproduce

  • Have (or create) a cron job whose deliver ends up null in jobs.json.
  • Run hermes cron list.
  • Observe the traceback above; no jobs listed.

Expected Behavior

cron list should tolerate deliver: null (and ideally normalize string vs. list forms), e.g.:

if not deliver:
    deliver_str = "—"        # or "(none)"
elif isinstance(deliver, str):
    deliver_str = deliver
else:
    deliver_str = ", ".join(deliver)

A malformed/empty delivery target on one job should not break listing of all jobs.

·## Notes
deliver appears to be typed/handled as a list at the display layer but stored as a scalar (str or null) at the job level. Worth reconciling the schema so creation and display agree on the type.

Actual Behavior

deliver values in jobs.json are inconsistent across jobs — some are strings, some are null:

d68c2728b513 -> None   (NoneType)
a0c124e55b1f -> None   (NoneType)
09dd0c24f29b -> None   (NoneType)
3fae80a61126 -> 'whatsapp:+34XXXXXXXXX'  (str)
7fc40f2b1cef -> 'local'  (str)

Affected Component

Configuration (config.yaml, .env, hermes setup), Agent Core (conversation loop, context compression, memory)

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

Debug report uploaded:
  Report       https://paste.rs/bh7ws
  agent.log    https://paste.rs/EwkrE
  gateway.log  https://paste.rs/xPuBc
  desktop.log  https://paste.rs/QnFnZ

Operating System

Ubuntu 24.04.2 LTS (GNU/Linux 6.6.87.1-microsoft-standard-WSL2 x86_64)

Python Version

3.11.15

Hermes Version

0.16.0

Additional Logs / Traceback (optional)

Traceback (most recent call last):
  File ".../hermes_cli/main.py", line 16035, in main
    args.func(args)
  File ".../hermes_cli/main.py", line 6534, in cmd_cron
    cron_command(args)
  File ".../hermes_cli/cron.py", line 335, in cron_command
    cron_list(show_all)
  File ".../hermes_cli/cron.py", line 95, in cron_list
    deliver_str = ", ".join(deliver)
                  ^^^^^^^^^^^^^^^^^^
TypeError: can only join an iterable

Root Cause Analysis (optional)

", ".join(deliver) at cron.py:95:

  • works on the string values (iterates char-by-char, no crash — though arguably also wrong, would render l, o, c, a, l),
  • raises TypeError on None.

Since cron_list iterates over all jobs and hits the exception on the first None, the whole command fails and zero jobs are displayed, even the well-formed ones.

Proposed Fix (optional)

Minimal — close the None gap in the default fallback that's already there. Change the .get() default to an or, so a present-but-null value also falls back to the default:

deliver = job.get("deliver") or ["local"]   # was: job.get("deliver", ["local"])
if isinstance(deliver, str):
    deliver = [deliver]
deliver_str = ", ".join(deliver)

job.get("deliver") or ["local"] routes None, "", and [] to the default, while the existing isinstance(str) branch keeps handling single/comma-separated string targets (deliver is multi-target by design, see #11602). One line, consistent with the current style, and stops one null-deliver job from breaking cron list for all jobs — including pre-existing jobs.json data that already contains deliver: null.

Notes (separate, lower priority)

The display fix above stops the crash for existing data. The deeper inconsistency is on the write side: cron_add/cron_update (around cron.py:218 and :284) persist deliver=getattr(args, "deliver", None), which is how deliver: null ends up in jobs.json in the first place. Normalizing deliver to a canonical shape at write time (default or empty list rather than None) would stop the inconsistency being written at all. That's a separate, smaller cleanup — not required to fix this crash, and probably its own issue/PR.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Activity

  1. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    comp/cliCLI entry point, hermes_cli/, setup wizard
    comp/cronCron scheduler and job management
    on Jun 7, 2026
  2. added a commit that references this issue on Jun 7, 2026
  3. liuhao1024 commented on Jun 7, 2026

    @liuhao1024

    This is fixed by #41398 — tolerates in cron job metadata so
    ┌─────────────────────────────────────────────────────────────────────────┐
    │ Scheduled Jobs │
    └─────────────────────────────────────────────────────────────────────────┘

    15fcf6c5edca [active]
    Name: 每日日报生成
    Schedule: 0 9 * * *
    Repeat: ∞
    Next run: 2026-06-08T09:00:00+08:00
    Deliver: origin
    Skills: llm-wiki-ingest
    Workdir: /Users/liuhao/llm-wiki
    Last run: 2026-06-07T09:10:56.852347+08:00 ok
    ⚠ Delivery failed: delivery error: Weixin send failed: iLink sendmessage rate limited: ret=-2 errcode=None errmsg=rate limited

    1bdb58f5b361 [active]
    Name: 每周知识库周报
    Schedule: 0 9 * * 1
    Repeat: ∞
    Next run: 2026-06-08T09:00:00+08:00
    Deliver: origin
    Skills: llm-wiki-ingest
    Workdir: /Users/liuhao/llm-wiki
    Last run: 2026-06-01T09:09:17.208419+08:00 ok

    9f474479d762 [active]
    Name: hermes-bugfix-contribution
    Schedule: every 5m
    Repeat: ∞
    Next run: 2026-06-08T05:28:07.437117+08:00
    Deliver: local
    Skills: high-caution-hermes-upstream-contribution-lite, hermes-pr-tracker
    Script: upstream_contribution_preflight.sh
    Workdir: /Users/liuhao/.hermes/workdir/hermes-agent
    Last run: 2026-06-08T05:12:43.479917+08:00 ok

    aaf7642d874f [active]
    Name: hermes-pr-tracker-sync
    Schedule: every 30m
    Repeat: ∞
    Next run: 2026-06-08T05:46:39.827725+08:00
    Deliver: local
    Skills: hermes-pr-tracker
    Script: pr_tracker_sync.sh
    Mode: no-agent (script stdout delivered directly)
    Workdir: /Users/liuhao/.hermes/pr-tracker
    Last run: 2026-06-08T05:16:39.827725+08:00 ok

    3cbb2ca3002c [active]
    Name: hermes-pr-review
    Schedule: every 5m
    Repeat: ∞
    Next run: 2026-06-08T05:28:58.001500+08:00
    Deliver: local
    Skills: github-code-review-lite, hermes-pr-tracker
    Last run: 2026-06-08T05:13:58.001500+08:00 ok

    ed57c700c945 [active]
    Name: hermes-feat-contribution
    Schedule: every 10m
    Repeat: ∞
    Next run: 2026-06-08T05:25:35.744039+08:00
    Deliver: local
    Skills: hermes-pr-tracker
    Script: hermes_feat_preflight.sh
    Workdir: /Users/liuhao/.hermes/workdir/hermes-agent-feat
    Last run: 2026-06-08T05:15:35.744039+08:00 ok doesn't crash with a TypeError.

  4. teknium1 commented on Jul 14, 2026

    @teknium1
    Collaborator

    This is already fixed on current main; closing via automated hermes-sweeper review.

    • 836732f54f7235d8cbae01f5cd4e1b86b0b70b49 (fix(cron): null-safe deliver in cron list + re-resolve BSM secrets per run) implements the reported deliver: null handling.
    • hermes_cli/cron.py:135 now coalesces null/empty delivery metadata to local before joining.
    • tests/hermes_cli/test_cron.py:145 persists deliver=None, runs the list command, and verifies it renders successfully.
    • The linked discussion around fix(cron): tolerate deliver=null in cron list display #41398 identified the same display-layer crash; current main contains an equivalent direct fix and regression coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/cliCLI entry point, hermes_cli/, setup wizardcomp/cronCron scheduler and job managementsweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions