gastownhall/beads · error

resolving --deps target %q: %w

Error message

resolving --deps target %q: %w

What it means

After basic validation, each non-external --deps target is passed to utils.ResolvePartialID, which turns a partial ID or bare slug into a canonical issue ID. If that resolution fails (no match, ambiguous prefix), resolveDepSpecTargets wraps the underlying error with this prefix so the offending target is named in the message.

Source

Thrown at cmd/bd/create_deps.go:123

// good fully-qualified row (GH#5005).
func resolveDepSpecTargets(ctx context.Context, st storage.Storage, specs []domain.DependencySpec) ([]domain.DependencySpec, error) {
	if len(specs) == 0 {
		return specs, nil
	}
	out := make([]domain.DependencySpec, len(specs))
	for i, spec := range specs {
		out[i] = spec
		target := strings.TrimSpace(spec.TargetID)
		if target == "" {
			return nil, fmt.Errorf("--deps target is empty")
		}
		if strings.HasPrefix(target, "external:") {
			out[i].TargetID = target
			continue
		}
		resolved, err := utils.ResolvePartialID(ctx, st, target)
		if err != nil {
			return nil, fmt.Errorf("resolving --deps target %q: %w", target, err)
		}
		out[i].TargetID = resolved
	}
	return out, nil
}

func parseDepSpec(raw string) (domain.DependencySpec, error) {
	if !strings.Contains(raw, ":") {
		return domain.DependencySpec{
			Type:     types.DepBlocks,
			TargetID: raw,
		}, nil
	}

	parts := strings.SplitN(raw, ":", 2)
	if len(parts) != 2 {
		return domain.DependencySpec{}, fmt.Errorf("invalid dependency format %q, expected 'type:id' or 'id'", raw)
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run `bd list` (or `bd show <partial>`) to find the correct full ID and use it
  2. Use a longer, unambiguous ID prefix so ResolvePartialID has a unique match
  3. Check you are in the right repo/database — the target issue may live elsewhere
  4. If the target is genuinely not a local issue, prefix it with "external:" to skip resolution

Example fix

// before
bd create "Task" --deps "blocked-by:bd-1"   # ambiguous: matches bd-1 and bd-10
// after
bd create "Task" --deps "blocked-by:bd-1a2b"  # longer unambiguous prefix
Defensive patterns

Strategy: validation

Validate before calling

out, err := exec.Command("bd", "show", partialID).CombinedOutput()
if err != nil {
    return fmt.Errorf("dep target %q does not resolve in this DB: %s", partialID, out)
}

Prevention

When it happens

Trigger: `bd create ... --deps "blocks:bd-999"` where bd-999 doesn't exist; a too-ambiguous prefix like "bd-1" matching multiple issues; a misspelled slug such as "blocks:auth-fix" when no issue has that slug. Only "external:..." targets bypass resolution.

Common situations: Typo'd or stale issue IDs from deleted/closed issues in another DB; running against a different .beads database than the one the IDs came from; abbreviated IDs that match more than one issue.

Related errors


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