{"record":{"id":"445a7da4149b0a54","repo":"stablyai/orca","slug":"invalid-argument-445a7d","errorCode":"invalid_argument","errorMessage":"--time can only be used with preset automation triggers","messagePattern":"--time can only be used with preset automation triggers","errorType":"exception","errorClass":"RuntimeClientError","httpStatus":null,"severity":"error","filePath":"src/cli/handlers/automations.ts","lineNumber":70,"sourceCode":"  repo?: string\n  workspace?: string\n}\n\nconst PRESET_TRIGGERS = new Set<AutomationSchedulePreset>(['hourly', 'daily', 'weekdays', 'weekly'])\nconst SCHEDULE_MODIFIER_FLAGS = ['day', 'time'] as const\n\nfunction getScheduleModifierFlag(flags: Map<string, string | boolean>): string | undefined {\n  return SCHEDULE_MODIFIER_FLAGS.find((flag) => flags.has(flag))\n}\n\nfunction validateScheduleModifierApplicability(\n  flags: Map<string, string | boolean>,\n  raw: string\n): void {\n  const isPreset = PRESET_TRIGGERS.has(raw as AutomationSchedulePreset)\n  if (!isPreset) {\n    if (flags.has('time')) {\n      throw new RuntimeClientError(\n        'invalid_argument',\n        '--time can only be used with preset automation triggers'\n      )\n    }\n    if (flags.has('day')) {\n      throw new RuntimeClientError(\n        'invalid_argument',\n        '--day can only be used with the weekly automation preset'\n      )\n    }\n    return\n  }\n  if (raw === 'hourly' && flags.has('time')) {\n    throw new RuntimeClientError(\n      'invalid_argument',\n      '--time cannot be used with the hourly automation preset; use a cron trigger such as \"30 * * * *\" to choose the minute'\n    )\n  }","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/cli/handlers/automations.ts#L52-L88","documentation":"Thrown by validateScheduleModifierApplicability() when `--time` is set but the trigger/schedule is not one of the preset values (hourly, daily, weekdays, weekly). For custom/cron triggers the time-of-day is meaningless because the cron expression already encodes timing, so the modifier is rejected. isPreset is computed from PRESET_TRIGGERS; the non-preset branch checks --time first, then --day.","triggerScenarios":"`orca automations create --trigger '0 9 * * *' --time 10:00` (cron trigger with --time); any custom/rrule trigger combined with --time. The cron expression's hour/minute already specify when to run, so --time is redundant and ambiguous.","commonSituations":"Copy-pasting a preset-style command and swapping in a cron expression while leaving --time; misunderstanding that --time only adjusts presets; templates that always set --time.","solutions":["Drop `--time` when using a cron/custom trigger; encode the time directly in the cron expression.","If you want a preset schedule, switch `--trigger` to one of hourly/daily/weekdays/weekly and keep --time.","Encode the desired hour/minute in the cron field, e.g. `0 10 * * *` instead of `--time 10:00`."],"exampleFix":"# before\norca automations create --trigger '0 9 * * *' --time 10:00   # ERROR\n\n# after\norca automations create --trigger '0 10 * * *'","handlingStrategy":"validation","validationCode":"const PRESETS = new Set(['hourly','daily','weekdays','weekly'])\nfunction validateTimeFlag(trigger: string|undefined, hasTime: boolean): void {\n  if (hasTime && trigger && !PRESETS.has(trigger)) {\n    throw new Error('--time requires a preset trigger (hourly/daily/weekdays/weekly)')\n  }\n}","typeGuard":"const isPresetTrigger = (t: string): boolean =>\n  new Set(['hourly','daily','weekdays','weekly']).has(t)","tryCatchPattern":"try {\n  await dispatch('automations create', ctx)\n} catch (e) {\n  if (e instanceof RuntimeClientError && e.code === 'invalid_argument' && /--time can only be used with preset/.test(e.message)) {\n    // remove --time or switch trigger to a preset\n  }\n  throw e\n}","preventionTips":["Only pair --time with hourly/daily/weekdays/weekly; for cron, encode time in the expression.","Validate trigger category before attaching schedule modifiers.","Keep templates preset-only or cron-only, not mixed."],"tags":["cli","automations","scheduling","argument-validation","invalid-argument"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}