Skip to content

systemEvent cron jobs fail with TypeError: Cannot read properties of undefined (reading 'trim') #52804

Description

@Justin-Ju-0413

Bug Description

Cron jobs with sessionTarget: 'main' and payload.kind: 'systemEvent' fail with the error:

TypeError: Cannot read properties of undefined (reading 'trim')

This affects the built-in morning-news and evening-news cron jobs. The error occurs immediately (duration 1ms) indicating a code path failure rather than a timeout.

Environment

  • OpenClaw: 2026.3.13
  • Channel: stable
  • OS: Linux 6.8.0
  • Node: v22.22.0
  • Deploy type: VPS (Gateway only, no local UI)

Cron Job Config

{
  "id": "254045f3-1b09-4b1e-a88b-92ef85308fa1",
  "name": "morning-news",
  "sessionTarget": "main",
  "payload": {
    "kind": "systemEvent",
    "message": "晨间新闻提醒"
  }
}

Expected Behavior

systemEvent jobs targeting the main session should fire normally and deliver the message.

Actual Behavior

  • Status: error
  • Duration: 1ms (instant failure)
  • Error: TypeError: Cannot read properties of undefined (reading 'trim')

Workaround

None known. Moving to isolated session with agentTurn works but loses channel context (WeChat delivery requires main session).

Related

  • Root session can receive and deliver messages normally
  • Gateway is functional (RPC reachable from local)
  • Isolated agentTurn cron jobs execute correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions