From 807624a812fff60253546877fc9191aee7638dba Mon Sep 17 00:00:00 2001 From: spiceoogway Date: Fri, 30 Jan 2026 00:42:04 -0500 Subject: [PATCH] fix: handle both jobId and id in cron list to prevent crash Fixes #4373 The printCronList function was crashing when accessing job.id because the Gateway API may return jobId instead of id depending on the version or context. This adds a defensive check that tries jobId first, then falls back to id, then to empty string. Changes: - src/cli/cron-cli/shared.ts: Extract id with type assertion to handle both jobId and id properties, preventing TypeError on .padEnd() --- src/cli/cron-cli/shared.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cli/cron-cli/shared.ts b/src/cli/cron-cli/shared.ts index 5e5efc81a..2e3ddaa61 100644 --- a/src/cli/cron-cli/shared.ts +++ b/src/cli/cron-cli/shared.ts @@ -141,7 +141,9 @@ export function printCronList(jobs: CronJob[], runtime = defaultRuntime) { const now = Date.now(); for (const job of jobs) { - const idLabel = pad(job.id, CRON_ID_PAD); + // Gateway may return either 'id' or 'jobId' depending on API version + const id = (job as CronJob & { jobId?: string }).jobId ?? job.id ?? ""; + const idLabel = pad(id, CRON_ID_PAD); const nameLabel = pad(truncate(job.name, CRON_NAME_PAD), CRON_NAME_PAD); const scheduleLabel = pad( truncate(formatSchedule(job.schedule), CRON_SCHEDULE_PAD),