{"record":{"id":"37bc65c892d2c1b9","repo":"gastownhall/beads","slug":"loading-molecule-w","errorCode":null,"errorMessage":"loading molecule: %w","messagePattern":"loading molecule: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_proxied_server.go","lineNumber":487,"sourceCode":"\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)\n\t}\n\n\tif result.SquashedCount == 0 && result.DigestID == \"\" {\n\t\tif jsonOutput {","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_proxied_server.go#L469-L505","documentation":"Wrapped error from loadTemplateSubgraph when loading the resolved molecule's full issue/dependency subgraph during `bd mol squash`. The molecule ID resolved fine, but reading its child issues and edges from storage failed, aborting the squash transaction.","triggerScenarios":"Run `bd mol squash <molID>` where the ID resolves but loadTemplateSubgraph fails: storage read error, missing child issues referenced by dependencies (corrupt/unsynced DB), or transaction-level driver failure.","commonSituations":"Partially synced Dolt database where dependency edges reference issues not yet pulled; `bd doctor`-detectable corruption; transient storage errors; children deleted out-of-band while edges remain.","solutions":["Read the wrapped inner error to distinguish not-found children from I/O failures","Run `bd doctor` to detect and repair broken dependency references","Run `bd dolt pull` to sync missing child issues created elsewhere","Retry the squash once the database is consistent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the molecule's children are all present before squashing\nbd mol show <molID>\nbd doctor   // detects dangling dependency references","typeGuard":null,"tryCatchPattern":"if err := runMolSquashProxiedServer(ctx, molID); err != nil {\n    if strings.Contains(err.Error(), \"loading molecule\") {\n        // repair then retry\n        exec.Command(\"bd\", \"doctor\").Run()\n        err = runMolSquashProxiedServer(ctx, molID)\n    }\n}","preventionTips":["Sync (`bd dolt pull`) before squashing molecules authored elsewhere","Never delete molecule child issues with raw `bd delete`; use `bd mol burn` so edges are removed together","Schedule periodic `bd doctor` integrity checks"],"tags":["go","storage","subgraph","squash","molecule"],"backgroundTag":"subgraph-load-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}