{"record":{"id":"67ebda14ff4b0ff2","repo":"multica-ai/multica","slug":"cron-is-only-valid-with-kind-schedule","errorCode":null,"errorMessage":"--cron is only valid with --kind schedule","messagePattern":"--cron is only valid with --kind schedule","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_autopilot.go","lineNumber":560,"sourceCode":"\t}\n\n\tkind, _ := cmd.Flags().GetString(\"kind\")\n\tif kind == \"\" {\n\t\tkind = \"schedule\"\n\t}\n\tif kind != \"schedule\" && kind != \"webhook\" {\n\t\treturn fmt.Errorf(\"--kind must be schedule or webhook\")\n\t}\n\tcron, _ := cmd.Flags().GetString(\"cron\")\n\tif kind == \"schedule\" && cron == \"\" {\n\t\treturn fmt.Errorf(\"--cron is required for --kind schedule\")\n\t}\n\tif kind == \"webhook\" {\n\t\tif v, _ := cmd.Flags().GetString(\"timezone\"); v != \"\" {\n\t\t\treturn fmt.Errorf(\"--timezone is only valid with --kind schedule\")\n\t\t}\n\t\tif cron != \"\" {\n\t\t\treturn fmt.Errorf(\"--cron is only valid with --kind schedule\")\n\t\t}\n\t}\n\n\tbody := map[string]any{\"kind\": kind}\n\tif kind == \"schedule\" {\n\t\tbody[\"cron_expression\"] = cron\n\t\tif v, _ := cmd.Flags().GetString(\"timezone\"); v != \"\" {\n\t\t\tbody[\"timezone\"] = v\n\t\t}\n\t}\n\tif v, _ := cmd.Flags().GetString(\"label\"); v != \"\" {\n\t\tbody[\"label\"] = v\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tautopilotRef, err := resolveAutopilotID(ctx, client, args[0])","sourceCodeStart":542,"sourceCodeEnd":578,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_autopilot.go#L542-L578","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","solutions":["Remove --cron from the webhook command","If you need scheduled firing, keep --kind schedule with the --cron value"],"exampleFix":"// before\nmultica autopilot trigger add my-pilot --kind webhook --cron '0 9 * * *'\n// --cron is only valid with --kind schedule\n\n// after\nmultica autopilot trigger add my-pilot --kind schedule --cron '0 9 * * *'","handlingStrategy":"validation","validationCode":"if [ \"$KIND\" = \"webhook\" ] && [ -n \"$CRON\" ]; then echo \"--cron is only valid with --kind schedule\" >&2; exit 2; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep webhook and schedule command templates separate","Assert flag/kind compatibility in wrappers before calling the CLI"],"tags":["go","cli","flag-validation","webhook","cron","triggers"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}