{"record":{"id":"82f886ee7de6ba9a","repo":"gastownhall/beads","slug":"resolving-issue-id-q-w","errorCode":null,"errorMessage":"resolving issue ID %q: %w","messagePattern":"resolving issue ID %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/label.go","lineNumber":232,"sourceCode":"// 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 {\n\t\tCheckReadonly(\"label add\")\n\n\t\tevt := metrics.NewCommandEvent(\"label-add\")","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/label.go#L214-L250","documentation":"The single-issue-ID variant of the label resolution failure: when exactly one issue ID is passed to `bd label add`/`remove` and resolveLabelTarget cannot resolve it, the CLI wraps the underlying error (typically ErrNotFound) as `resolving issue ID %q: %w` without the multi-ID hint.","triggerScenarios":"`bd label add <bad-id> mylabel` or `bd label remove <bad-id> mylabel` where the ID does not match any issue (typo, deleted issue, wisp/ID mismatch).","commonSituations":"Typo'd or truncated IDs from copy-paste; referencing an issue in a different repo/database; using a prefix that is ambiguous or nonexistent.","solutions":["Run `bd list` to find the correct issue ID and retry.","Verify the ID with `bd show <id>`; check you are in the right repository/database.","If the issue was deleted, recreate it or use a different issue."],"exampleFix":"// before\nbd label add bd-999 mylabel\n// after\nbd label add bd-123 mylabel   // verified with bd show bd-123","handlingStrategy":"try-catch","validationCode":"bd show \"$ID\" >/dev/null 2>&1 || { echo \"issue $ID not found\" >&2; exit 1; }\nbd label add \"$ID\" \"$LABEL\"","typeGuard":null,"tryCatchPattern":"out=$(bd label add \"$ID\" \"$LABEL\" 2>&1) || {\n  case \"$out\" in *\"resolving issue ID\"*) echo \"bad issue id: $ID\" >&2;; *) echo \"$out\" >&2;; esac\n  exit 1\n}","preventionTips":["Copy full issue IDs, not truncated prefixes, unless prefix resolution is supported.","Check bd list after deletions to purge stale ID references.","Run within the correct repository/database."],"tags":["cli","labels","not-found"],"backgroundTag":"issue-id-resolution-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}