stablyai/orca · error · RuntimeClientError

invalid_argument

invalid_argument

Error message

--time can only be used with preset automation triggers

What it means

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.

Source

Thrown at src/cli/handlers/automations.ts:70

  repo?: string
  workspace?: string
}

const PRESET_TRIGGERS = new Set<AutomationSchedulePreset>(['hourly', 'daily', 'weekdays', 'weekly'])
const SCHEDULE_MODIFIER_FLAGS = ['day', 'time'] as const

function getScheduleModifierFlag(flags: Map<string, string | boolean>): string | undefined {
  return SCHEDULE_MODIFIER_FLAGS.find((flag) => flags.has(flag))
}

function validateScheduleModifierApplicability(
  flags: Map<string, string | boolean>,
  raw: string
): void {
  const isPreset = PRESET_TRIGGERS.has(raw as AutomationSchedulePreset)
  if (!isPreset) {
    if (flags.has('time')) {
      throw new RuntimeClientError(
        'invalid_argument',
        '--time can only be used with preset automation triggers'
      )
    }
    if (flags.has('day')) {
      throw new RuntimeClientError(
        'invalid_argument',
        '--day can only be used with the weekly automation preset'
      )
    }
    return
  }
  if (raw === 'hourly' && flags.has('time')) {
    throw new RuntimeClientError(
      'invalid_argument',
      '--time cannot be used with the hourly automation preset; use a cron trigger such as "30 * * * *" to choose the minute'
    )
  }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Drop `--time` when using a cron/custom trigger; encode the time directly in the cron expression.
  2. If you want a preset schedule, switch `--trigger` to one of hourly/daily/weekdays/weekly and keep --time.
  3. Encode the desired hour/minute in the cron field, e.g. `0 10 * * *` instead of `--time 10:00`.

Example fix

# before
orca automations create --trigger '0 9 * * *' --time 10:00   # ERROR

# after
orca automations create --trigger '0 10 * * *'
Defensive patterns

Strategy: validation

Validate before calling

const PRESETS = new Set(['hourly','daily','weekdays','weekly'])
function validateTimeFlag(trigger: string|undefined, hasTime: boolean): void {
  if (hasTime && trigger && !PRESETS.has(trigger)) {
    throw new Error('--time requires a preset trigger (hourly/daily/weekdays/weekly)')
  }
}

Type guard

const isPresetTrigger = (t: string): boolean =>
  new Set(['hourly','daily','weekdays','weekly']).has(t)

Try / catch

try {
  await dispatch('automations create', ctx)
} catch (e) {
  if (e instanceof RuntimeClientError && e.code === 'invalid_argument' && /--time can only be used with preset/.test(e.message)) {
    // remove --time or switch trigger to a preset
  }
  throw e
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/445a7da4149b0a54. Report an issue: GitHub.