multica-ai/multica · error

--cron is only valid with --kind schedule

Error message

--cron is only valid with --kind schedule

What it means

Flag validation in `multica autopilot trigger add` rejecting --cron when the trigger kind is webhook. Cron expressions only apply to schedule triggers; for webhooks they are meaningless and the CLI fails fast rather than silently dropping the flag. Client-side check, no HTTP request.

Source

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

	}

	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 != "" {
		body["label"] = v
	}

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	autopilotRef, err := resolveAutopilotID(ctx, client, args[0])

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Remove --cron from the webhook command
  2. If you need scheduled firing, keep --kind schedule with the --cron value

Example fix

// before
multica autopilot trigger add my-pilot --kind webhook --cron '0 9 * * *'
// --cron is only valid with --kind schedule

// after
multica autopilot trigger add my-pilot --kind schedule --cron '0 9 * * *'
Defensive patterns

Strategy: validation

Validate before calling

if [ "$KIND" = "webhook" ] && [ -n "$CRON" ]; then echo "--cron is only valid with --kind schedule" >&2; exit 2; fi

Prevention

When it happens

Trigger: Running `autopilot trigger add <ref> --kind webhook --cron '0 9 * * *'`. Note the kind check at line 549 ran first, so --kind is exactly 'webhook' here.

Common situations: Converting a schedule trigger to webhook without cleaning up flags; templates that always pass --cron; misreading 'webhook triggers can also be rate-limited by cron'.

Related errors


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