{"record":{"id":"e7b9b36be06aff0f","repo":"nexu-io/open-design","slug":"schedule-weekly-day-must-be-0-6-or-sun-sat-got","errorCode":null,"errorMessage":"--schedule weekly day must be 0-6 or sun..sat (got \"${parts[1]}\")","messagePattern":"--schedule weekly day must be 0-6 or sun\\.\\.sat \\(got \"(.+?)\"\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/cli.ts","lineNumber":10529,"sourceCode":"    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')}`;\n    if (!/^[0-2]\\d:[0-5]\\d$/.test(time)) {\n      throw new Error('--schedule weekly time must be HH:MM (24h)');\n    }\n    const timezone = parts.slice(4).join(':') || 'UTC';\n    return { kind: 'weekly', weekday, time, timezone };\n  }\n  throw new Error(`--schedule kind must be hourly|daily|weekdays|weekly (got \"${kind}\")`);\n}\n\nfunction parseAutomationTarget(flags) {\n  const raw = flags.target;\n  if (raw == null) {\n    if (flags.project) return { mode: 'reuse', projectId: String(flags.project) };\n    return { mode: 'create_each_run' };\n  }\n  const value = String(raw);","sourceCodeStart":10511,"sourceCodeEnd":10547,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/cli.ts#L10511-L10547","documentation":"Thrown by parseScheduleFlag for a weekly schedule when the day token is neither a single digit 0-6 nor a recognized entry in AUTOMATION_WEEKDAY_TOKENS (the sun/mon/tue/wed/thu/fri/sat map). The token is lowercased first, so case does not matter, but the value must be one of those exact abbreviations or a 0-6 digit.","triggerScenarios":"Running `--schedule weekly:8:09:30` (digit out of 0-6), `--schedule weekly:Monday:09:30` (full name, not the 3-letter token), `--schedule weekly:funday:09:30`, or `--schedule weekly:7:09:30` (1-based indexing).","commonSituations":"Using full weekday names ('monday'), 1-based day numbers (1-7), or a typo in the abbreviation. The accepted tokens are 0-6 (0 = Sunday) or the three-letter sun..sat forms.","solutions":["Use a digit 0-6 where 0 is Sunday, e.g. `--schedule weekly:1:09:30` for Monday.","Or use the three-letter lowercase abbreviation, e.g. `--schedule weekly:mon:09:30`.","Avoid full names like 'Monday' and 1-based 1-7 numbering."],"exampleFix":"// before\n--schedule weekly:Monday:09:30\n// after\n--schedule weekly:mon:09:30","handlingStrategy":"validation","validationCode":"const WEEKDAY_TOKENS = ['sun','mon','tue','wed','thu','fri','sat'];\nfunction isValidWeeklyDay(token: string): boolean {\n  const t = token.toLowerCase();\n  return /^[0-6]$/.test(t) || WEEKDAY_TOKENS.includes(t);\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseScheduleFlag(raw);\n} catch (err) {\n  if (err instanceof Error && /weekly day must be 0-6 or sun..sat/.test(err.message)) {\n    // re-prompt for a valid day token\n  }\n  throw err;\n}","preventionTips":["Use 0-6 (0 = Sunday) or the exact three-letter sun..sat abbreviations.","Avoid full day names like 'Monday' and 1-based 1-7 numbering."],"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"}