multica-ai/multica · error

resolve trigger: %w

Error message

resolve trigger: %w

What it means

Wrapped error from resolveAutopilotTriggerID in `multica autopilot trigger rotate-webhook-url`. After the autopilot resolves, the trigger argument must resolve too: a full UUID is used directly, otherwise the CLI GETs /api/autopilots/{autopilotID} and prefix-matches against the embedded triggers array. Failure means the trigger reference was not found, was ambiguous among that autopilot's triggers, or the GET failed.

Source

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

	}
}

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

	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)
	}

	// Confirmation: rotation invalidates the current URL immediately. The UI
	// version uses an AlertDialog; the CLI mirrors that with a y/N prompt
	// unless --yes was passed for scripted use. Style matches confirmOverwrite
	// in cmd_setup.go.
	yes, _ := cmd.Flags().GetBool("yes")
	if !yes {
		fmt.Fprintln(os.Stderr, "This will invalidate the current webhook URL immediately. Continue? [y/N] ")
		reader := bufio.NewReader(os.Stdin)
		answer, _ := reader.ReadString('\n')
		answer = strings.TrimSpace(strings.ToLower(answer))
		if answer != "y" && answer != "yes" {
			fmt.Fprintln(os.Stderr, "Aborted.")
			return nil
		}
	}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Fetch the trigger list: `multica autopilot triggers <autopilot-id>` (or GET /api/autopilots/{id}) and use the full trigger UUID
  2. Confirm the trigger belongs to the autopilot you named
  3. Fix auth if the wrapped error shows an HTTP failure on the GET

Example fix

// before
multica autopilot trigger rotate-webhook-url my-pilot 1a2b
// resolve trigger: no autopilot trigger matches prefix "1a2b"

// after
multica autopilot trigger rotate-webhook-url my-pilot 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d --yes
Defensive patterns

Strategy: validation

Validate before calling

TRIGGER=$(curl -s -H "Authorization: Bearer $TOKEN" "$API/api/autopilots/$ID" | jq -r ".triggers[] | select(.kind==\"webhook\") | .id" | head -1)
[ -n "$TRIGGER" ] || { echo "no webhook trigger on autopilot" >&2; exit 1; }

Prevention

When it happens

Trigger: Trigger prefix matching zero or multiple trigger IDs on the autopilot; GET /api/autopilots/{id} returning 401/404/5xx; triggers array missing or empty in the response so no candidates exist. Rotation never happens on this path.

Common situations: The webhook trigger was deleted in the UI before rotation; copying only the first characters of a trigger UUID; referencing a trigger that belongs to a different autopilot.

Related errors


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