{"record":{"id":"f95f82422ae96754","repo":"gastownhall/beads","slug":"squashing-molecule-w","errorCode":null,"errorMessage":"squashing molecule: %w","messagePattern":"squashing molecule: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_proxied_server.go","lineNumber":496,"sourceCode":"\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)\n\t}\n\n\tif result.SquashedCount == 0 && result.DigestID == \"\" {\n\t\tif jsonOutput {\n\t\t\treturn outputJSON(result)\n\t\t}\n\t\tfmt.Printf(\"No ephemeral children found for molecule %s\\n\", result.MoleculeID)\n\t\treturn nil\n\t}\n\n\treturn renderSquashResult(result)\n}\n","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_proxied_server.go#L478-L514","documentation":"Wrapped error from squashMoleculeInto during `bd mol squash`. The molecule and its wisp children loaded fine, but the actual squash — closing/collapsing the wisp children into the molecule root per --keep/--summary options — failed, rolling back the transaction.","triggerScenarios":"Run `bd mol squash <molID>` where squashMoleculeInto fails: updating/closing wisp children hits a storage error, a status transition is invalid, the actor cannot close an issue (validation), or summary text handling fails.","commonSituations":"Wisp children already closed or in a state the squash logic rejects; concurrent modification of children during squash; storage write failure; readonly mode or permission constraint.","solutions":["Read the wrapped inner error to find the specific child or write that failed","Run `bd show <molID>` and inspect child states; close/reopen inconsistent children manually if needed","Retry — the transaction rolls back atomically so state remains consistent","Check that the command is not running under a conflicting readonly/ephemeral mode (CheckReadonly analog)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Inspect child states first\nbd mol show <molID>   // confirm wisps are open and squashable","typeGuard":"func squashFailed(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"squashing molecule\")\n}","tryCatchPattern":"err := runMolSquashProxiedServer(ctx, molID)\nif squashFailed(err) {\n    // transaction rolled back; molecule unchanged — safe to inspect and retry\n    log.Printf(\"squash aborted, state consistent: %v\", err)\n}","preventionTips":["Squash molecules when their wisps are complete; avoid squashing partially-closed graphs","Avoid concurrent mutations of the same molecule","Retry squashes safely — the transaction guarantees all-or-nothing"],"tags":["go","squash","molecule","storage"],"backgroundTag":"squash-transaction-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}