{"record":{"id":"92d81b65452bf05c","repo":"multica-ai/multica","slug":"no-fields-to-update-use-enabled-cron-time","errorCode":null,"errorMessage":"no fields to update; use --enabled, --cron, --timezone, or --label","messagePattern":"no fields to update; use --enabled, --cron, --timezone, or --label","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_autopilot.go","lineNumber":686,"sourceCode":"\tbody := map[string]any{}\n\tif cmd.Flags().Changed(\"enabled\") {\n\t\tv, _ := cmd.Flags().GetBool(\"enabled\")\n\t\tbody[\"enabled\"] = v\n\t}\n\tif cmd.Flags().Changed(\"cron\") {\n\t\tv, _ := cmd.Flags().GetString(\"cron\")\n\t\tbody[\"cron_expression\"] = v\n\t}\n\tif cmd.Flags().Changed(\"timezone\") {\n\t\tv, _ := cmd.Flags().GetString(\"timezone\")\n\t\tbody[\"timezone\"] = v\n\t}\n\tif cmd.Flags().Changed(\"label\") {\n\t\tv, _ := cmd.Flags().GetString(\"label\")\n\t\tbody[\"label\"] = v\n\t}\n\tif len(body) == 0 {\n\t\treturn fmt.Errorf(\"no fields to update; use --enabled, --cron, --timezone, or --label\")\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tautopilotRef, err := resolveAutopilotID(ctx, client, args[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resolve autopilot: %w\", err)\n\t}\n\ttriggerRef, err := resolveAutopilotTriggerID(ctx, client, autopilotRef.ID, args[1])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resolve trigger: %w\", err)\n\t}\n\n\tvar result map[string]any\n\tpath := \"/api/autopilots/\" + autopilotRef.ID + \"/triggers/\" + triggerRef.ID\n\tif err := client.PatchJSON(ctx, path, body, &result); err != nil {\n\t\treturn fmt.Errorf(\"update trigger: %w\", err)","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_autopilot.go#L668-L704","documentation":"Flag validation in `multica autopilot trigger update` requiring at least one field flag. The command builds a PATCH body only from flags explicitly marked Changed() (--enabled, --cron, --timezone, --label); if none changed, the body map is empty and there is nothing to PATCH, so the CLI fails fast instead of issuing a no-op request.","triggerScenarios":"Running `autopilot trigger update <autopilot> <trigger>` with no field flags at all; passing flags that this command does not read (e.g. --kind) which therefore do not count toward the body. Client-side only; no network call.","commonSituations":"Expecting an interactive edit mode; using --kind which is add-only; environment-variable-driven invocations that omit all field flags by accident.","solutions":["Include at least one of --enabled, --cron, --timezone, or --label","To flip a trigger on/off: `--enabled true` / `--enabled false`","To change a schedule: combine --cron (and --timezone if needed)"],"exampleFix":"// before\nmultica autopilot trigger update my-pilot tr1\n// no fields to update; use --enabled, --cron, --timezone, or --label\n\n// after\nmultica autopilot trigger update my-pilot tr1 --enabled false","handlingStrategy":"validation","validationCode":"[ \"$#\" -ge 0 ] && { [ -n \"$ENABLED\" ] || [ -n \"$CRON\" ] || [ -n \"$TZ\" ] || [ -n \"$LABEL\" ]; } || { echo \"no fields to update\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require at least one field flag in wrapper scripts","Remember --kind is add-only; updates use --enabled/--cron/--timezone/--label","Use `--enabled true|false` for simple toggles"],"tags":["go","cli","flag-validation","triggers"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}