{"record":{"id":"a15fc1ba9bba8dbc","repo":"argoproj/argo-workflows","slug":"cron-schedules-must-consist-of-5-values-only","errorCode":null,"errorMessage":"cron schedules must consist of 5 values only","messagePattern":"cron schedules must consist of 5 values only","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"ui/src/cron-workflows/pretty-schedule.tsx","lineNumber":18,"sourceCode":"import x from 'cronstrue';\nimport * as React from 'react';\n\nimport {WarningIcon} from '../shared/components/fa-icons';\n\n/*\n    https://github.com/bradymholt/cRonstrue\n    vs\n    https://github.com/robfig/cron\n\n    I think we must assume that these libraries (or any two libraries) will never be exactly the same and accept that\n    sometime it'll not work as expected. Therefore, we must let the user know about this.\n */\n\nexport function PrettySchedule({schedule}: {schedule: string}) {\n    try {\n        if (schedule.split(' ').length >= 6) {\n            throw new Error('cron schedules must consist of 5 values only');\n        } else if (schedule.startsWith('@every')) {\n            return null;\n        }\n\n        const pretty = x.toString(schedule);\n        return <span title={pretty}>{pretty}</span>;\n    } catch (e) {\n        return (\n            <span>\n                <WarningIcon /> {e.toString()}\n            </span>\n        );\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/ui/src/cron-workflows/pretty-schedule.tsx#L1-L33","documentation":"PrettySchedule renders a human-friendly version of a cron schedule. It only supports standard 5-field cron expressions; if the schedule string has 6 or more space-separated values it deliberately throws so the user knows the schedule can't be pretty-printed (likely a seconds-field cron).","triggerScenarios":"Rendering a CronWorkflow whose spec.schedule contains a 6+ field expression, e.g. '0 0 0 * * *' (seconds included) or a multi-word parser expression.","commonSituations":"Users pasting Quartz-style cron (with seconds) from other systems like Spring or Quartz Scheduler; extra accidental whitespace counting as extra fields.","solutions":["Use a standard 5-field cron expression in the CronWorkflow spec.","Strip any seconds field before rendering: drop the leading token.","Handle the thrown error in the component boundary and display the raw schedule instead."],"exampleFix":"// before\nschedule: '0 0 9 * * *' // 6 fields, throws\n// after\nschedule: '0 9 * * *' // 5 fields","handlingStrategy":"validation","validationCode":"const fields = schedule.trim().split(/\\s+/);\nif (fields.length !== 5) {\n  throw new Error(`expected 5-field cron, got ${fields.length}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return <PrettySchedule schedule={schedule} />;\n} catch (e) {\n  return <span title=\"unsupported format\">{schedule}</span>;\n}","preventionTips":["Use only 5-field cron expressions in CronWorkflow specs.","Trim and normalize whitespace before rendering schedules.","Convert Quartz 6-field crons to 5-field equivalents."],"tags":["ui","cron","validation"],"backgroundTag":"invalid-cron-expression","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}