{"record":{"id":"2f3a9b627dcc2f47","repo":"gastownhall/beads","slug":"bonding-w","errorCode":null,"errorMessage":"bonding: %w","messagePattern":"bonding: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_proxied_server.go","lineNumber":431,"sourceCode":"\n\t\tissueA := subgraphA.Root\n\t\tissueB := subgraphB.Root\n\t\taIsProto := issueA.IsTemplate || cookedA\n\t\tbIsProto := issueB.IsTemplate || cookedB\n\n\t\tvar result *BondResult\n\t\tswitch {\n\t\tcase aIsProto && bIsProto:\n\t\t\tresult, err = bondProtoProtoInto(ctx, w, issueA, issueB, in.bondType, in.customTitle, actor)\n\t\tcase aIsProto && !bIsProto:\n\t\t\tresult, err = bondProtoMolAttachInto(ctx, w, subgraphA, issueA, issueB, in.bondType, in.vars, in.childRef, actor, in.ephemeral, in.pour)\n\t\tcase !aIsProto && bIsProto:\n\t\t\tresult, err = bondProtoMolAttachInto(ctx, w, subgraphB, issueB, issueA, in.bondType, in.vars, in.childRef, actor, in.ephemeral, in.pour)\n\t\tdefault:\n\t\t\tresult, err = bondMolMolInto(ctx, w, issueA, issueB, in.bondType, actor)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn bondTxResult{}, \"\", fmt.Errorf(\"bonding: %w\", err)\n\t\t}\n\t\treturn bondTxResult{result: result, idA: issueA.ID, idB: issueB.ID},\n\t\t\tfmt.Sprintf(\"bd: mol bond %s %s\", issueA.ID, issueB.ID), nil\n\t})\n\tif err != nil {\n\t\treturn HandleErrorRespectJSON(\"%v\", err)\n\t}\n\n\treturn renderMolBondResult(res.result, res.idA, res.idB, in.ephemeral, in.pour)\n}\n\nfunc runMolSquashProxiedServer(ctx context.Context, in molSquashInput) error {\n\tCheckReadonly(\"mol squash\")\n\n\tif uowProvider == nil {\n\t\treturn HandleErrorRespectJSON(\"proxied-server UOW provider not initialized\")\n\t}\n","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_proxied_server.go#L413-L449","documentation":"Wrapped error from the molecule bonding step inside the `bd mol bond` proxied-server transaction. After both issues load and the correct bonding path is chosen (proto+proto, proto+mol, or mol+mol via bondMolMolInto), executing the bond failed; the error is surfaced through HandleErrorRespectJSON and the transaction rolls back.","triggerScenarios":"Run `bd mol bond <idA> <idB>` where the selected bond function (bondProtoMolAttachInto or bondMolMolInto) fails: one issue is already bonded, bond type invalid, dependency cycle would be created, or storage write failure.","commonSituations":"Trying to bond a molecule to itself or to an issue already sharing that dependency edge; invalid --bond-type; variable requirements of the attached proto unmet; concurrent modification of either molecule.","solutions":["Inspect the inner error to determine whether it is a cycle, duplicate bond, or storage failure","Run `bd show <idA>` / `bd show <idB>` to check existing dependencies before re-bonding","Use a valid bond type flag and ensure neither ID is the other's ancestor (cycle)","If a proto attach, supply any --var values its template requires"],"exampleFix":"// before\nbd mol bond bd-100 bd-200 --bond-type blocks   // fails: cycle: bd-100 already blocks bd-200 indirectly\n// after\nbd show bd-100                                 // inspect deps, remove conflicting edge, then bond\nbd mol bond bd-100 bd-200 --bond-type related","handlingStrategy":"validation","validationCode":"// Check existing dependencies before bonding\nbd show <idA>\nbd show <idB>\n// Ensure neither is an ancestor of the other (would create a cycle)","typeGuard":"func bondFailedBetween(err error) (a, b string, ok bool) {\n    // bondTxResult carries idA/idB; parse \"mol bond <a> <b>\" from context or inspect deps first\n    return \"\", \"\", err != nil\n}","tryCatchPattern":"if err := runMolBondProxiedServer(ctx, in); err != nil {\n    if strings.Contains(err.Error(), \"cycle\") {\n        return fmt.Errorf(\"choose a different bond type or restructure the molecule graph\")\n    }\n    return err\n}","preventionTips":["Inspect both molecules' dependency graphs before bonding","Use `bd dep tree` (or `bd show`) to detect would-be cycles","Bond types must be valid for the pair; check `bd mol bond --help`"],"tags":["go","bond","molecule","dependency-cycle"],"backgroundTag":"molecule-bond-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}