{"record":{"id":"45cef2d62be2c56b","repo":"gastownhall/beads","slug":"loading-spawned-mol-w","errorCode":null,"errorMessage":"loading spawned mol: %w","messagePattern":"loading spawned mol: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_proxied_server.go","lineNumber":134,"sourceCode":"\t\t\trenderPourDryRun(protoID, subgraph, vars, in.assignee, in.attachType, previews)\n\t\t\treturn pourProxiedResult{}, \"\", nil\n\t\t}\n\n\t\tspawnResult, err := cloneSubgraphInto(ctx, w, subgraph, CloneOptions{\n\t\t\tVars:     vars,\n\t\t\tAssignee: in.assignee,\n\t\t\tActor:    actor,\n\t\t\tPrefix:   types.IDPrefixMol,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"pouring proto: %w\", err)\n\t\t}\n\n\t\ttotalAttached := 0\n\t\tif len(attachments) > 0 {\n\t\t\tspawnedMol, err := w.GetIssue(ctx, spawnResult.NewEpicID)\n\t\t\tif err != nil {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"loading spawned mol: %w\", err)\n\t\t\t}\n\t\t\tfor _, attach := range attachments {\n\t\t\t\tbondResult, err := bondProtoMolAttachInto(ctx, w, attach.subgraph, attach.issue, spawnedMol, in.attachType, vars, \"\", actor, false, true)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"attaching %s: %w\", attach.id, err)\n\t\t\t\t}\n\t\t\t\ttotalAttached += bondResult.Spawned\n\t\t\t}\n\t\t}\n\n\t\treturn pourProxiedResult{spawn: spawnResult, totalAttached: totalAttached, attachCount: len(attachments)},\n\t\t\tfmt.Sprintf(\"bd: mol pour %s\", protoID), nil\n\t})\n\tif err != nil {\n\t\treturn HandleError(\"%v\", err)\n\t}\n\tif res.spawn == nil {\n\t\treturn nil","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_proxied_server.go#L116-L152","documentation":"Wrapped error from w.GetIssue on spawnResult.NewEpicID. Cloning the proto subgraph succeeded, but re-loading the freshly created epic (mol root) immediately afterwards failed. This happens only when the pour included --attach arguments, since the spawned mol must be loaded before attachments can be bonded into it.","triggerScenarios":"Run `bd mol pour <proto> --attach ...` where the clone step returned a NewEpicID but a subsequent GetIssue for that ID fails — e.g. the ID is not yet visible to reads inside the same transaction (isolation/visibility bug) or a storage read error occurs.","commonSituations":"Storage backend read-after-write inconsistency; concurrent process deleted or modified the mol between create and read; transient driver failure mid-transaction.","solutions":["Retry the pour; the transaction aborts atomically so no orphaned molecule remains","Check the inner error for 'not found' vs I/O failure — 'not found' suggests a read-visibility or concurrency bug worth reporting","Ensure no concurrent `bd` process is mutating molecules while pouring","Update to the latest beads version, as read-after-write visibility inside UOW transactions may be fixed upstream"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := runPourProxiedServer(ctx, in); err != nil {\n    if strings.Contains(err.Error(), \"loading spawned mol\") {\n        // transient read-after-write issue; retry once\n        err = runPourProxiedServer(ctx, in)\n    }\n}","preventionTips":["Retry pours — the transaction is atomic so retries never duplicate molecules","Report persistent occurrences upstream; a consistently failing GetIssue on a just-created ID indicates a visibility bug","Avoid third-party tools that delete issues while pours are in flight"],"tags":["go","storage","read-after-write","pour","molecule"],"backgroundTag":"read-after-write-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}