gastownhall/beads · error

resolving molecule ID %s: %w

Error message

resolving molecule ID %s: %w

What it means

Wrapped error from utils.ResolvePartialID while turning the user-supplied (possibly partial) molecule argument into a full issue ID during `bd mol squash`. The argument could not be resolved to exactly one existing issue, so the squash transaction aborts before loading the molecule.

Source

Thrown at cmd/bd/mol_proxied_server.go:483

		}
		wispChildren := wispChildrenOf(subgraph)
		if len(wispChildren) == 0 {
			if jsonOutput {
				return outputJSON(SquashResult{MoleculeID: moleculeID, SquashedCount: 0})
			}
			fmt.Printf("No ephemeral children found for molecule %s\n", moleculeID)
			return nil
		}
		renderSquashDryRun(moleculeID, subgraph, wispChildren, in.keepChildren)
		return nil
	}

	result, err := uow.RunTxResult(ctx, uowProvider, func(ctx context.Context, uw uow.UnitOfWork) (*SquashResult, string, error) {
		w := newUOWMolWriter(uw)

		moleculeID, err := utils.ResolvePartialID(ctx, w, in.moleculeArg)
		if err != nil {
			return nil, "", fmt.Errorf("resolving molecule ID %s: %w", in.moleculeArg, err)
		}
		subgraph, err := loadTemplateSubgraph(ctx, w, moleculeID)
		if err != nil {
			return nil, "", fmt.Errorf("loading molecule: %w", err)
		}
		wispChildren := wispChildrenOf(subgraph)
		if len(wispChildren) == 0 {
			return &SquashResult{MoleculeID: moleculeID, SquashedCount: 0}, "", nil
		}

		result, err := squashMoleculeInto(ctx, w, subgraph.Root, wispChildren, in.keepChildren, in.summary, actor)
		if err != nil {
			return nil, "", fmt.Errorf("squashing molecule: %w", err)
		}
		return result, fmt.Sprintf("bd: mol squash %s", moleculeID), nil
	})
	if err != nil {
		return HandleErrorRespectJSON("%v", err)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run `bd list` or `bd mol show <prefix>` to find the exact full molecule ID and re-run with it
  2. Extend the partial ID until it is unambiguous (e.g. bd-10 -> bd-1042)
  3. Confirm you are in the repo whose .beads database contains the molecule
  4. If the molecule was deleted, recreate it instead of squashing

Example fix

// before
bd mol squash bd-10        // fails: resolves to multiple IDs
// after
bd mol squash bd-1042      // use the full unambiguous ID
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the exact ID first
bd list | grep -w "bd-10"   // list candidates sharing the prefix
// Then squash with the full ID

Type guard

func resolveUniquePrefix(ctx context.Context, w MolWriter, partial string) (string, error) {
    id, err := utils.ResolvePartialID(ctx, w, partial)
    if err != nil {
        return "", fmt.Errorf("prefix %q is ambiguous or unknown; run bd list to disambiguate", partial)
    }
    return id, nil
}

Try / catch

if err := runMolSquashProxiedServer(ctx, arg); err != nil {
    if strings.Contains(err.Error(), "resolving molecule ID") {
        return fmt.Errorf("use a longer ID prefix; see `bd list`")
    }
    return err
}

Prevention

When it happens

Trigger: Run `bd mol squash <arg>` where <arg> is not a full ID, matches multiple issues, or matches nothing — ResolvePartialID fails on ambiguity or not-found.

Common situations: Typo in a partial ID prefix; two issues share the prefix; the molecule was closed/deleted or lives in a different database; running in the wrong working directory so a different .beads DB is opened.

Related errors


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