multica-ai/multica · error

--cron is required for --kind schedule

Error message

--cron is required for --kind schedule

What it means

Flag validation in `multica autopilot trigger add` requiring a cron expression for schedule triggers. A schedule trigger without a cron expression has no firing time, so the CLI refuses to build the request body before touching the network. The cron string is sent as cron_expression in the POST body.

Source

Thrown at server/cmd/multica/cmd_autopilot.go:553

	return nil
}

func runAutopilotTriggerAdd(cmd *cobra.Command, args []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

	kind, _ := cmd.Flags().GetString("kind")
	if kind == "" {
		kind = "schedule"
	}
	if kind != "schedule" && kind != "webhook" {
		return fmt.Errorf("--kind must be schedule or webhook")
	}
	cron, _ := cmd.Flags().GetString("cron")
	if kind == "schedule" && cron == "" {
		return fmt.Errorf("--cron is required for --kind schedule")
	}
	if kind == "webhook" {
		if v, _ := cmd.Flags().GetString("timezone"); v != "" {
			return fmt.Errorf("--timezone is only valid with --kind schedule")
		}
		if cron != "" {
			return fmt.Errorf("--cron is only valid with --kind schedule")
		}
	}

	body := map[string]any{"kind": kind}
	if kind == "schedule" {
		body["cron_expression"] = cron
		if v, _ := cmd.Flags().GetString("timezone"); v != "" {
			body["timezone"] = v
		}
	}
	if v, _ := cmd.Flags().GetString("label"); v != "" {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Add --cron with a valid 5-field cron expression, e.g. --cron '0 9 * * 1-5'
  2. If you wanted an on-demand URL instead, use --kind webhook which must NOT have --cron

Example fix

// before
multica autopilot trigger add my-pilot
// --cron is required for --kind schedule

// after
multica autopilot trigger add my-pilot --kind schedule --cron '0 9 * * 1-5' --timezone Europe/Berlin
Defensive patterns

Strategy: validation

Validate before calling

[ -n "$CRON" ] || { echo "--cron is required for --kind schedule" >&2; exit 2; }
multica autopilot trigger add "$ID" --kind schedule --cron "$CRON"

Prevention

When it happens

Trigger: Running `autopilot trigger add <ref>` or `--kind schedule` without --cron. Client-side only; no API call is made.

Common situations: Assuming the server has a default schedule; forgetting that the empty --kind default is 'schedule', so a bare command needs --cron; switching a command from webhook to schedule and dropping the flag.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/91349787c7e9a344. Report an issue: GitHub.