{"record":{"id":"91349787c7e9a344","repo":"multica-ai/multica","slug":"cron-is-required-for-kind-schedule","errorCode":null,"errorMessage":"--cron is required for --kind schedule","messagePattern":"--cron is required for --kind schedule","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_autopilot.go","lineNumber":553,"sourceCode":"\treturn nil\n}\n\nfunc runAutopilotTriggerAdd(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\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 != \"\" {","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_autopilot.go#L535-L571","documentation":"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.","triggerScenarios":"Running `autopilot trigger add <ref>` or `--kind schedule` without --cron. Client-side only; no API call is made.","commonSituations":"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.","solutions":["Add --cron with a valid 5-field cron expression, e.g. --cron '0 9 * * 1-5'","If you wanted an on-demand URL instead, use --kind webhook which must NOT have --cron"],"exampleFix":"// before\nmultica autopilot trigger add my-pilot\n// --cron is required for --kind schedule\n\n// after\nmultica autopilot trigger add my-pilot --kind schedule --cron '0 9 * * 1-5' --timezone Europe/Berlin","handlingStrategy":"validation","validationCode":"[ -n \"$CRON\" ] || { echo \"--cron is required for --kind schedule\" >&2; exit 2; }\nmultica autopilot trigger add \"$ID\" --kind schedule --cron \"$CRON\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --cron as mandatory in any wrapper that defaults kind to schedule","Remember the empty --kind default is 'schedule', not 'none'","Store cron expressions in one place (env/config) so they are never accidentally empty"],"tags":["go","cli","flag-validation","cron","triggers"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}