{"record":{"id":"02db2e74c86c01c4","repo":"multica-ai/multica","slug":"resolve-trigger-w","errorCode":null,"errorMessage":"resolve trigger: %w","messagePattern":"resolve trigger: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_autopilot.go","lineNumber":628,"sourceCode":"\t}\n}\n\nfunc runAutopilotTriggerRotateURL(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()\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\t// Confirmation: rotation invalidates the current URL immediately. The UI\n\t// version uses an AlertDialog; the CLI mirrors that with a y/N prompt\n\t// unless --yes was passed for scripted use. Style matches confirmOverwrite\n\t// in cmd_setup.go.\n\tyes, _ := cmd.Flags().GetBool(\"yes\")\n\tif !yes {\n\t\tfmt.Fprintln(os.Stderr, \"This will invalidate the current webhook URL immediately. Continue? [y/N] \")\n\t\treader := bufio.NewReader(os.Stdin)\n\t\tanswer, _ := reader.ReadString('\\n')\n\t\tanswer = strings.TrimSpace(strings.ToLower(answer))\n\t\tif answer != \"y\" && answer != \"yes\" {\n\t\t\tfmt.Fprintln(os.Stderr, \"Aborted.\")\n\t\t\treturn nil\n\t\t}\n\t}\n","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_autopilot.go#L610-L646","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fetch the trigger list: `multica autopilot triggers <autopilot-id>` (or GET /api/autopilots/{id}) and use the full trigger UUID","Confirm the trigger belongs to the autopilot you named","Fix auth if the wrapped error shows an HTTP failure on the GET"],"exampleFix":"// before\nmultica autopilot trigger rotate-webhook-url my-pilot 1a2b\n// resolve trigger: no autopilot trigger matches prefix \"1a2b\"\n\n// after\nmultica autopilot trigger rotate-webhook-url my-pilot 1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d --yes","handlingStrategy":"validation","validationCode":"TRIGGER=$(curl -s -H \"Authorization: Bearer $TOKEN\" \"$API/api/autopilots/$ID\" | jq -r \".triggers[] | select(.kind==\\\"webhook\\\") | .id\" | head -1)\n[ -n \"$TRIGGER\" ] || { echo \"no webhook trigger on autopilot\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fetch the trigger list from the autopilot before referencing triggers by prefix","Filter by kind=webhook — only webhook triggers can rotate","Pass full trigger UUIDs in automation"],"tags":["go","cli","id-resolution","webhook","triggers"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}