{"record":{"id":"4c4f05bb001bc80b","repo":"gastownhall/beads","slug":"resolving-molecule-id-s-w","errorCode":null,"errorMessage":"resolving molecule ID %s: %w","messagePattern":"resolving molecule ID (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_proxied_server.go","lineNumber":483,"sourceCode":"\t\t}\n\t\twispChildren := wispChildrenOf(subgraph)\n\t\tif len(wispChildren) == 0 {\n\t\t\tif jsonOutput {\n\t\t\t\treturn outputJSON(SquashResult{MoleculeID: moleculeID, SquashedCount: 0})\n\t\t\t}\n\t\t\tfmt.Printf(\"No ephemeral children found for molecule %s\\n\", moleculeID)\n\t\t\treturn nil\n\t\t}\n\t\trenderSquashDryRun(moleculeID, subgraph, wispChildren, in.keepChildren)\n\t\treturn nil\n\t}\n\n\tresult, err := uow.RunTxResult(ctx, uowProvider, func(ctx context.Context, uw uow.UnitOfWork) (*SquashResult, string, error) {\n\t\tw := newUOWMolWriter(uw)\n\n\t\tmoleculeID, err := utils.ResolvePartialID(ctx, w, in.moleculeArg)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", fmt.Errorf(\"resolving molecule ID %s: %w\", in.moleculeArg, err)\n\t\t}\n\t\tsubgraph, err := loadTemplateSubgraph(ctx, w, moleculeID)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", fmt.Errorf(\"loading molecule: %w\", err)\n\t\t}\n\t\twispChildren := wispChildrenOf(subgraph)\n\t\tif len(wispChildren) == 0 {\n\t\t\treturn &SquashResult{MoleculeID: moleculeID, SquashedCount: 0}, \"\", nil\n\t\t}\n\n\t\tresult, err := squashMoleculeInto(ctx, w, subgraph.Root, wispChildren, in.keepChildren, in.summary, actor)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", fmt.Errorf(\"squashing molecule: %w\", err)\n\t\t}\n\t\treturn result, fmt.Sprintf(\"bd: mol squash %s\", moleculeID), nil\n\t})\n\tif err != nil {\n\t\treturn HandleErrorRespectJSON(\"%v\", err)","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_proxied_server.go#L465-L501","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `bd list` or `bd mol show <prefix>` to find the exact full molecule ID and re-run with it","Extend the partial ID until it is unambiguous (e.g. bd-10 -> bd-1042)","Confirm you are in the repo whose .beads database contains the molecule","If the molecule was deleted, recreate it instead of squashing"],"exampleFix":"// before\nbd mol squash bd-10        // fails: resolves to multiple IDs\n// after\nbd mol squash bd-1042      // use the full unambiguous ID","handlingStrategy":"validation","validationCode":"// Resolve the exact ID first\nbd list | grep -w \"bd-10\"   // list candidates sharing the prefix\n// Then squash with the full ID","typeGuard":"func resolveUniquePrefix(ctx context.Context, w MolWriter, partial string) (string, error) {\n    id, err := utils.ResolvePartialID(ctx, w, partial)\n    if err != nil {\n        return \"\", fmt.Errorf(\"prefix %q is ambiguous or unknown; run bd list to disambiguate\", partial)\n    }\n    return id, nil\n}","tryCatchPattern":"if err := runMolSquashProxiedServer(ctx, arg); err != nil {\n    if strings.Contains(err.Error(), \"resolving molecule ID\") {\n        return fmt.Errorf(\"use a longer ID prefix; see `bd list`\")\n    }\n    return err\n}","preventionTips":["Always tab-complete or copy full molecule IDs instead of short prefixes in scripts","Run molecule commands from the repo root so the intended .beads database is opened","Confirm the molecule still exists (`bd show <id>`) before squashing"],"tags":["go","id-resolution","squash","molecule"],"backgroundTag":"ambiguous-id-resolution","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}