{"record":{"id":"04cec1d0b4568afc","repo":"nexu-io/open-design","slug":"schedule-kind-time-must-be-hh-mm-24h","errorCode":null,"errorMessage":"--schedule ${kind} time must be HH:MM (24h)","messagePattern":"--schedule (.+?) time must be HH:MM \\(24h\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/cli.ts","lineNumber":10513,"sourceCode":"  }\n  const parts = raw.split(':');\n  const kind = parts[0];\n  if (kind === 'hourly') {\n    const minute = Number(parts[1]);\n    if (!Number.isInteger(minute) || minute < 0 || minute > 59) {\n      throw new Error('--schedule hourly requires :<minute>, 0-59');\n    }\n    return { kind: 'hourly', minute };\n  }\n  if (kind === 'daily' || kind === 'weekdays') {\n    if (parts.length < 3) {\n      throw new Error(`--schedule ${kind} requires :HH:MM[:TZ]`);\n    }\n    const hh = parts[1];\n    const mm = parts[2];\n    const time = `${hh.padStart(2, '0')}:${mm.padStart(2, '0')}`;\n    if (!/^[0-2]\\d:[0-5]\\d$/.test(time)) {\n      throw new Error(`--schedule ${kind} time must be HH:MM (24h)`);\n    }\n    const timezone = parts.slice(3).join(':') || 'UTC';\n    return { kind, time, timezone };\n  }\n  if (kind === 'weekly') {\n    if (parts.length < 4) {\n      throw new Error('--schedule weekly requires :DAY:HH:MM[:TZ] (DAY is 0-6 or sun/mon/...)');\n    }\n    const dayToken = String(parts[1]).toLowerCase();\n    let weekday;\n    if (/^[0-6]$/.test(dayToken)) {\n      weekday = Number(dayToken);\n    } else if (AUTOMATION_WEEKDAY_TOKENS[dayToken] !== undefined) {\n      weekday = AUTOMATION_WEEKDAY_TOKENS[dayToken];\n    } else {\n      throw new Error(`--schedule weekly day must be 0-6 or sun..sat (got \"${parts[1]}\")`);\n    }\n    const time = `${parts[2].padStart(2, '0')}:${parts[3].padStart(2, '0')}`;","sourceCodeStart":10495,"sourceCodeEnd":10531,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/cli.ts#L10495-L10531","documentation":"Thrown by parseScheduleFlag in the `od automation` CLI when the HH:MM portion of a `--schedule daily:HH:MM` or `--schedule weekdays:HH:MM` flag fails the 24h regex `/^[0-2]\\d:[0-5]\\d$/`. The hour and minute tokens are zero-padded with padStart before the test, so the check is purely on numeric range, not on whether you supplied leading zeros. The `${kind}` interpolates to `daily` or `weekdays`.","triggerScenarios":"Running `od automation create --schedule daily:25:30` (hour out of range), `--schedule weekdays:09:60` (minute >59), `--schedule daily:abc:def` (non-numeric), or `--schedule daily:2:30pm` (the `pm` suffix becomes the minute token and fails).","commonSituations":"Typing the time in 12-hour format with an AM/PM suffix, using `24:00` for midnight, appending seconds `09:30:00` (which actually passes here because only parts[1]/parts[2] are tested and the rest become timezone), or copy-pasting a locale-formatted time like `9.30`.","solutions":["Use a plain 24h HH:MM value, e.g. `--schedule daily:14:30` (leading zeros optional, the parser pads).","Remove any AM/PM suffix; 14:30 is 2:30pm, 09:30 is 9:30am.","If you need a timezone, append it as a trailing colon segment: `--schedule daily:14:30:America/New_York`.","Double-check the hour is 00-23 and the minute is 00-59 before submitting."],"exampleFix":"// before\n--schedule daily:2:30pm\n// after\n--schedule daily:14:30","handlingStrategy":"validation","validationCode":"// Validate a daily/weekdays schedule time before invoking the CLI/parser.\nfunction isValid24hTime(raw: string): boolean {\n  const parts = raw.split(':');\n  if (parts.length < 3) return false;\n  const time = `${parts[1].padStart(2, '0')}:${parts[2].padStart(2, '0')}`;\n  return /^[0-2]\\d:[0-5]\\d$/.test(time);\n}\n// usage: isValid24hTime('daily:14:30') === true","typeGuard":null,"tryCatchPattern":"try {\n  const schedule = parseScheduleFlag(raw);\n} catch (err) {\n  if (err instanceof Error && /time must be HH:MM/.test(err.message)) {\n    // surface a user-facing 'enter a valid 24h time' message\n  }\n  throw err;\n}","preventionTips":["Always pass time as 24h HH:MM with no AM/PM suffix.","Pre-validate the flag string with the same regex the parser uses.","When embedding `od` in scripts, build the flag from numeric fields you control, not free user text."],"tags":["cli","validation","automation","schedule","flag-parsing"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}