{"record":{"id":"eafed3147606444b","repo":"multica-ai/multica","slug":"update-trigger-w","errorCode":null,"errorMessage":"update trigger: %w","messagePattern":"update trigger: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_autopilot.go","lineNumber":704,"sourceCode":"\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)\n\t}\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"json\" {\n\t\treturn cli.PrintJSON(os.Stdout, result)\n\t}\n\tfmt.Printf(\"Trigger updated: %s\\n\", strVal(result, \"id\"))\n\treturn nil\n}\n\nfunc runAutopilotTriggerDelete(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_autopilot.go#L686-L722","documentation":"Wrapped error from PATCH /api/autopilots/{id}/triggers/{triggerID} in `multica autopilot trigger update`. Both IDs resolved and a non-empty body (enabled/cron_expression/timezone/label subset) was sent; the server rejected the update or the request failed in transit under cli.APIContext.","triggerScenarios":"PATCH returning 400 for an invalid cron_expression or unknown timezone in the update body, 404 for a concurrently deleted trigger, 403 for insufficient permission, 409 for conflicting concurrent modifications, or network/timeout failure.","commonSituations":"Setting --cron to a 6-field Quartz string on a server expecting 5-field cron; typo'd timezone; editing a trigger another admin just deleted; service-account token without update rights.","solutions":["Inspect the wrapped response body for the exact field rejected (cron/timezone syntax is validated server-side)","Re-resolve the trigger — 404 means it disappeared; recreate it with `trigger add` if so","Fix credentials on 401/403","Retry transient 5xx once"],"exampleFix":"// before\nmultica autopilot trigger update my-pilot tr1 --cron '0 0 9 * * *'\n// update trigger: request failed: 400: invalid cron expression\n\n// after\nmultica autopilot trigger update my-pilot tr1 --cron '0 9 * * *'","handlingStrategy":"try-catch","validationCode":"[ \"$(echo \"$CRON\" | awk '{print NF}')\" -eq 5 ] || { echo \"cron must have 5 fields\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":"Inspect the wrapped error: 400 names the invalid field (fix cron/timezone syntax and rerun); 404 means the trigger vanished — recreate with `trigger add`; 401/403 -> re-auth; 5xx -> bounded single retry.","preventionTips":["Validate cron and timezone values in wrappers before PATCHing","Re-resolve trigger IDs when deletes may have raced your update","Keep field sets minimal — only send flags you intend to change"],"tags":["go","cli","http-patch","cron","triggers"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}