{"record":{"id":"d0ccadd8a7a0724f","repo":"multica-ai/multica","slug":"ambiguous-agent-q-matches-s","errorCode":null,"errorMessage":"ambiguous agent %q; matches:\n%s","messagePattern":"ambiguous agent %q; matches:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_autopilot.go","lineNumber":811,"sourceCode":"\tvar matches []match\n\tfor _, a := range agents {\n\t\taName := strVal(a, \"name\")\n\t\tif strings.Contains(strings.ToLower(aName), nameLower) {\n\t\t\tmatches = append(matches, match{ID: strVal(a, \"id\"), Name: aName})\n\t\t}\n\t}\n\n\tswitch len(matches) {\n\tcase 0:\n\t\treturn \"\", fmt.Errorf(\"no agent found matching %q\", nameOrID)\n\tcase 1:\n\t\treturn matches[0].ID, nil\n\tdefault:\n\t\tvar parts []string\n\t\tfor _, m := range matches {\n\t\t\tparts = append(parts, fmt.Sprintf(\"  %q (%s)\", m.Name, truncateID(m.ID)))\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"ambiguous agent %q; matches:\\n%s\", nameOrID, strings.Join(parts, \"\\n\"))\n\t}\n}\n","sourceCodeStart":793,"sourceCodeEnd":814,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_autopilot.go#L793-L814","documentation":"resolveAgent does case-insensitive substring matching, so a short query can match several agents. When more than one agent name contains the query string, the CLI refuses to guess and lists every match with its truncated UUID so the user can disambiguate.","triggerScenarios":"`--agent bot` when the workspace has 'triage-bot', 'review-bot', and 'deploy-bot'; any prefix like 'a' matching many agent names.","commonSituations":"Naming schemes that share a common suffix/prefix; auto-generated agent names with a shared stem; abbreviating names in scripts.","solutions":["Use a longer, unique substring of the intended agent's name from the printed match list.","Or use the exact UUID shown next to the intended match (e.g. the full form of the truncated ID)."],"exampleFix":"# before: ambiguous\nmultica autopilot trigger create --name t1 --agent bot\n# after\nmultica autopilot trigger create --name t1 --agent review-bot","handlingStrategy":"validation","validationCode":"# refuse ambiguous names before invoking the CLI\ncount=$(multica api get \"/api/agents?workspace_id=$WS\" | jq --arg n \"$AGENT\" '[.[] | select((.name | ascii_downcase | contains($n | ascii_downcase)))] | length')\n[ \"$count\" -eq 1 ] || { echo \"agent '$AGENT' matched $count agents; use a UUID\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to full agent UUIDs in scripts; use substring names only interactively.","Adopt unique agent-name stems per function (triage-bot vs review-bot) so short queries stay ambiguous."],"tags":["cli","agents","resolution","ambiguity","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}