{"record":{"id":"e1f8d2fdce087e2d","repo":"gastownhall/beads","slug":"resolving-issue-id-q-w-to-s-multiple-labels","errorCode":null,"errorMessage":"resolving issue ID %q: %w (to %s multiple labels, pass one comma-separated argument: bd label %s <issue-id> label1,label2)","messagePattern":"resolving issue ID %q: %w \\(to (.+?) multiple labels, pass one comma-separated argument: bd label (.+?) <issue-id> label1,label2\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/label.go","lineNumber":229,"sourceCode":"//\n// Resolution stays a front-door job and does not move behind the role:\n// GetRequest.ID and UpdateRequest.IssueID are both exact by contract, for the\n// reason those docs give — an affordance that can resolve to a different issue\n// than the caller named has no place on a contract two front doors share. This\n// is therefore the ONE thing that still forks by route, and it forks on how a\n// route reaches the store rather than on what it then does with the answer.\n//\n// Labels come last on the command line, so when several ID-position args fail\n// the caller almost certainly passed labels space-separated (\"bd label add\n// bd-123 a b c\"); the error hints at the comma-separated form instead of\n// silently skipping the bad args (bd-vu5kv).\nfunc resolveLabelIssueIDs(ctx context.Context, subcommand string, issueIDs []string) ([]string, error) {\n\tresolved := make([]string, 0, len(issueIDs))\n\tfor _, id := range issueIDs {\n\t\tfullID, err := resolveLabelTarget(ctx, id)\n\t\tif err != nil {\n\t\t\tif len(issueIDs) > 1 {\n\t\t\t\treturn nil, fmt.Errorf(\"resolving issue ID %q: %w (to %s multiple labels, pass one comma-separated argument: bd label %s <issue-id> label1,label2)\",\n\t\t\t\t\tid, err, subcommand, subcommand)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"resolving issue ID %q: %w\", id, err)\n\t\t}\n\t\tresolved = append(resolved, fullID)\n\t}\n\treturn resolved, nil\n}\n\n//nolint:dupl // labelAddCmd and labelRemoveCmd are similar but serve different operations\nvar labelAddCmd = &cobra.Command{\n\tUse:           \"add [issue-id...] [label[,label...]]\",\n\tShort:         \"Add one or more labels to one or more issues\",\n\tLong:          \"Add labels to issues. Issue IDs come first; the final argument is the label. Pass multiple labels comma-separated: bd label add bd-123 label1,label2\",\n\tArgs:          cobra.MinimumNArgs(2),\n\tSilenceUsage:  true,\n\tSilenceErrors: true,\n\tRunE: func(cmd *cobra.Command, args []string) error {","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/label.go#L211-L247","documentation":"When `bd label add`/`bd label remove` receives multiple issue IDs and one of them fails to resolve to a real issue, resolveLabelIssueIDs wraps the failure and appends a hint telling the caller to use a single comma-separated labels argument (`bd label <sub> <issue-id> label1,label2`) instead. The %w-wrapped underlying error (usually a not-found) is preserved.","triggerScenarios":"`bd label add <bad-id> <other-id> mylabel` (or the remove equivalent) where issueIDs contains >1 entry and resolveLabelTarget fails for one of them — typically a mistyped or deleted issue ID.","commonSituations":"Bulk-labeling several issues where one ID was truncated, renamed, or belongs to another database; confusing the argument order (passing labels as separate args so they are parsed as issue IDs).","solutions":["Check each issue ID with `bd show <id>` and fix the invalid one.","If you meant multiple labels on one issue, pass them comma-separated on a single argument: bd label add <issue-id> label1,label2.","Re-run listing only valid issue IDs."],"exampleFix":"// before\nbd label add bd-999999 bd-123 bug,urgent   // bd-999999 unresolvable\n// after\nbd label add bd-123 bug,urgent             // one issue, comma-separated labels","handlingStrategy":"validation","validationCode":"for id in \"${IDS[@]}\"; do bd show \"$id\" >/dev/null || { echo \"invalid id: $id\" >&2; exit 1; }; done\nbd label add \"${IDS[0]}\" \"label1,label2\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember the CLI contract: one issue ID + comma-separated labels, not N ids per label.","Resolve/verify all IDs with bd show before bulk operations.","Avoid building arg lists dynamically where labels can be misread as IDs."],"tags":["cli","labels","argument-parsing"],"backgroundTag":"issue-id-resolution-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}