multica-ai/multica · error

update trigger: %w

Error message

update trigger: %w

What it means

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.

Source

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

		return fmt.Errorf("no fields to update; use --enabled, --cron, --timezone, or --label")
	}

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

	autopilotRef, err := resolveAutopilotID(ctx, client, args[0])
	if err != nil {
		return fmt.Errorf("resolve autopilot: %w", err)
	}
	triggerRef, err := resolveAutopilotTriggerID(ctx, client, autopilotRef.ID, args[1])
	if err != nil {
		return fmt.Errorf("resolve trigger: %w", err)
	}

	var result map[string]any
	path := "/api/autopilots/" + autopilotRef.ID + "/triggers/" + triggerRef.ID
	if err := client.PatchJSON(ctx, path, body, &result); err != nil {
		return fmt.Errorf("update trigger: %w", err)
	}

	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, result)
	}
	fmt.Printf("Trigger updated: %s\n", strVal(result, "id"))
	return nil
}

func runAutopilotTriggerDelete(cmd *cobra.Command, args []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

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

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Inspect the wrapped response body for the exact field rejected (cron/timezone syntax is validated server-side)
  2. Re-resolve the trigger — 404 means it disappeared; recreate it with `trigger add` if so
  3. Fix credentials on 401/403
  4. Retry transient 5xx once

Example fix

// before
multica autopilot trigger update my-pilot tr1 --cron '0 0 9 * * *'
// update trigger: request failed: 400: invalid cron expression

// after
multica autopilot trigger update my-pilot tr1 --cron '0 9 * * *'
Defensive patterns

Strategy: try-catch

Validate before calling

[ "$(echo "$CRON" | awk '{print NF}')" -eq 5 ] || { echo "cron must have 5 fields" >&2; exit 2; }

Try / catch

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.

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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