gastownhall/beads · error

resolving issue ID %q: %w

Error message

resolving issue ID %q: %w

What it means

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.

Source

Thrown at cmd/bd/label.go:232

// reason those docs give — an affordance that can resolve to a different issue
// than the caller named has no place on a contract two front doors share. This
// is therefore the ONE thing that still forks by route, and it forks on how a
// route reaches the store rather than on what it then does with the answer.
//
// Labels come last on the command line, so when several ID-position args fail
// the caller almost certainly passed labels space-separated ("bd label add
// bd-123 a b c"); the error hints at the comma-separated form instead of
// silently skipping the bad args (bd-vu5kv).
func resolveLabelIssueIDs(ctx context.Context, subcommand string, issueIDs []string) ([]string, error) {
	resolved := make([]string, 0, len(issueIDs))
	for _, id := range issueIDs {
		fullID, err := resolveLabelTarget(ctx, id)
		if err != nil {
			if len(issueIDs) > 1 {
				return nil, fmt.Errorf("resolving issue ID %q: %w (to %s multiple labels, pass one comma-separated argument: bd label %s <issue-id> label1,label2)",
					id, err, subcommand, subcommand)
			}
			return nil, fmt.Errorf("resolving issue ID %q: %w", id, err)
		}
		resolved = append(resolved, fullID)
	}
	return resolved, nil
}

//nolint:dupl // labelAddCmd and labelRemoveCmd are similar but serve different operations
var labelAddCmd = &cobra.Command{
	Use:           "add [issue-id...] [label[,label...]]",
	Short:         "Add one or more labels to one or more issues",
	Long:          "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",
	Args:          cobra.MinimumNArgs(2),
	SilenceUsage:  true,
	SilenceErrors: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		CheckReadonly("label add")

		evt := metrics.NewCommandEvent("label-add")

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run `bd list` to find the correct issue ID and retry.
  2. Verify the ID with `bd show <id>`; check you are in the right repository/database.
  3. If the issue was deleted, recreate it or use a different issue.

Example fix

// before
bd label add bd-999 mylabel
// after
bd label add bd-123 mylabel   // verified with bd show bd-123
Defensive patterns

Strategy: try-catch

Validate before calling

bd show "$ID" >/dev/null 2>&1 || { echo "issue $ID not found" >&2; exit 1; }
bd label add "$ID" "$LABEL"

Try / catch

out=$(bd label add "$ID" "$LABEL" 2>&1) || {
  case "$out" in *"resolving issue ID"*) echo "bad issue id: $ID" >&2;; *) echo "$out" >&2;; esac
  exit 1
}

Prevention

When it happens

Trigger: `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).

Common situations: Typo'd or truncated IDs from copy-paste; referencing an issue in a different repo/database; using a prefix that is ambiguous or nonexistent.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/82f886ee7de6ba9a. Report an issue: GitHub.