gastownhall/beads · error

resolving attachment ID %s: %w

Error message

resolving attachment ID %s: %w

What it means

When pouring with --attach arguments, each attachment argument is resolved to a full issue ID via ResolvePartialID. This error wraps the resolution failure, so the attachment argument was neither a complete ID nor resolvable to a unique existing issue. The wrapped cause from ResolvePartialID is preserved.

Source

Thrown at cmd/bd/mol_proxied_server.go:85

			if !isProto(protoIssue) {
				return pourProxiedResult{}, "", fmt.Errorf("%s is not a proto (missing '%s' label)", protoID, MoleculeLabel)
			}
			subgraph, err = loadTemplateSubgraph(ctx, w, protoID)
			if err != nil {
				return pourProxiedResult{}, "", fmt.Errorf("loading proto: %w", err)
			}
		}

		type attachmentInfo struct {
			id       string
			issue    *types.Issue
			subgraph *TemplateSubgraph
		}
		var attachments []attachmentInfo
		for _, attachArg := range in.attachArgs {
			attachID, err := utils.ResolvePartialID(ctx, w, attachArg)
			if err != nil {
				return pourProxiedResult{}, "", fmt.Errorf("resolving attachment ID %s: %w", attachArg, err)
			}
			attachIssue, err := w.GetIssue(ctx, attachID)
			if err != nil {
				return pourProxiedResult{}, "", fmt.Errorf("loading attachment %s: %w", attachID, err)
			}
			if !isProto(attachIssue) {
				return pourProxiedResult{}, "", fmt.Errorf("%s is not a proto (missing '%s' label)", attachID, MoleculeLabel)
			}
			attachSubgraph, err := loadTemplateSubgraph(ctx, w, attachID)
			if err != nil {
				return pourProxiedResult{}, "", fmt.Errorf("loading attachment subgraph %s: %w", attachID, err)
			}
			attachments = append(attachments, attachmentInfo{attachID, attachIssue, attachSubgraph})
		}

		vars := applyVariableDefaults(vars, subgraph)

		var attachSubgraphs []*TemplateSubgraph

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run bd list and copy the exact attachment ID into --attach
  2. Check you're in the repository whose database contains the attachment proto
  3. Sync (bd dolt pull) if the attachment was created on another machine
  4. Retry with a longer, unambiguous ID prefix

Example fix

// before
$ bd mol pour mol-fix --attach bd-9
Error: resolving attachment ID bd-9: ...
// after
$ bd list | grep attach
$ bd mol pour mol-fix --attach bd-900
Defensive patterns

Strategy: validation

Validate before calling

// resolve each --attach argument before pouring
for _, arg := range attachArgs {
	if _, err := utils.ResolvePartialID(ctx, reader, arg); err != nil {
		return fmt.Errorf("--attach %q does not resolve to an issue", arg)
	}
}

Try / catch

err := pourCmd(args)
if err != nil && strings.Contains(err.Error(), "resolving attachment ID") {
	return fmt.Errorf("bad --attach value; see `bd list` for valid IDs")
}

Prevention

When it happens

Trigger: Running `bd mol pour <proto> --attach <arg>` where <arg> is a typo'd partial ID, an ID that doesn't exist in the current database, or an ambiguous prefix matching multiple issues (depending on resolver behavior).

Common situations: Typos or truncated prefixes that don't match; attaching protos stored in a different repo/database; referencing an attachment deleted by gc or not yet synced from another machine.

Related errors


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