openclaw - ✅(Solved) Fix TypeError: Cannot read properties of undefined (reading 'padEnd') in cron table formatter [2 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#57872Fetched 2026-04-08 01:56:37
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
referenced ×3cross-referenced ×2

Error Message

Error Details

Error: This error appears frequently in logs and may interfere with cron job monitoring and debugging. It doesn't seem to affect actual job execution, but it clutters logs and makes troubleshooting harder. Error observed when running with multiple cron jobs, some of which have missing state fields or undefined schedule values. The error appears to originate from the table formatting code that displays job status in the CLI.

Fix Action

Fixed

PR fix notes

PR #57897: fix(cron): guard against undefined values in cron table formatter

Description (problem / solution / changelog)

Summary

  • Widen the pad helper in src/cli/cron-cli/shared.ts to accept string | undefined | null, falling back to "-" for missing values.
  • Prevents TypeError: Cannot read properties of undefined (reading 'padEnd') when cron jobs have undefined fields.

Validation

  • Verified the pad function signature change is type-safe: (value ?? "-").padEnd(width) always receives a string.
  • The "-" fallback is consistent with how other columns already handle absent data (e.g., job.sessionTarget ?? "-" on line 241, job.agentId ?? "-" on line 242).

Notes

  • This is a defense-in-depth fix. Ideally the gateway should not produce jobs with missing id/name, but the formatter should not crash when it happens.
  • The error repeats every ~60 seconds in logs, cluttering debugging output.

Closes #57872

Changed files

  • src/cli/cron-cli/shared.ts (modified, +2/-1)

PR #57944: fix(cron): handle undefined state in cron table formatter

Description (problem / solution / changelog)

Summary

Fixes #57872

Changes

Add null checks for job.state in printCronList() to prevent TypeError when calling padEnd() on undefined values.

Changed files

  • docs/gateway/sandboxing.md (modified, +1/-1)
  • docs/install/migrating.md (modified, +1/-1)
  • docs/providers/index.md (modified, +1/-1)
  • docs/tools/exec-approvals.md (modified, +2/-2)
  • docs/tools/index.md (modified, +42/-0)
  • src/cli/cron-cli/shared.ts (modified, +5/-2)
RAW_BUFFERClick to expand / collapse

Bug Description

Cron table formatting crashes when displaying jobs with undefined values in the schedule or state fields.

Error Details

Location: Error: Frequency: Repeats approximately every 60 seconds

Steps to Reproduce

  1. Create a cron job with missing or undefined fields in the schedule or state
  2. Run 'openclaw cron list' or let the cron table formatter run
  3. Observe the TypeError in logs

Expected Behavior

The formatter should gracefully handle undefined/null values by showing empty strings or "N/A" rather than crashing.

Actual Behavior

Environment

  • OpenClaw Version: 2026.3.28
  • Node Version: v25.8.0
  • OS: Linux (WSL2)

Suggested Fix

Add null/undefined checks before calling on values in the cron table formatter. Something like:

Impact

This error appears frequently in logs and may interfere with cron job monitoring and debugging. It doesn't seem to affect actual job execution, but it clutters logs and makes troubleshooting harder.

Additional Context

Error observed when running with multiple cron jobs, some of which have missing state fields or undefined schedule values. The error appears to originate from the table formatting code that displays job status in the CLI.


Happy to provide more details or test a fix if needed!

extent analysis

Fix Plan

To resolve the issue, we need to add null and undefined checks in the cron table formatter. Here are the steps:

  • Identify the code section responsible for formatting the cron table.
  • Add checks for null or undefined values before attempting to display them.
  • Replace null or undefined values with a default string, such as an empty string or "N/A".

Example code snippet:

// Before
console.log(`Schedule: ${job.schedule}, State: ${job.state}`);

// After
console.log(`Schedule: ${job.schedule || 'N/A'}, State: ${job.state || 'N/A'}`);

Alternatively, you can use the Optional Chaining Operator (?.) to safely navigate nested properties:

console.log(`Schedule: ${job?.schedule || 'N/A'}, State: ${job?.state || 'N/A'}`);

Verification

To verify the fix, follow these steps:

  • Create a cron job with missing or undefined fields in the schedule or state.
  • Run openclaw cron list or let the cron table formatter run.
  • Check the logs for the absence of the TypeError.
  • Verify that the cron table is displayed correctly, with empty strings or "N/A" in place of null or undefined values.

Extra Tips

  • Make sure to test the fix with different scenarios, including jobs with valid and invalid data.
  • Consider adding additional error handling and logging to improve the overall robustness of the cron table formatter.
  • Review the code for other potential null or undefined value issues and address them accordingly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix TypeError: Cannot read properties of undefined (reading 'padEnd') in cron table formatter [2 pull requests, 1 comments, 1 participants]