{"record":{"id":"a26140b1da3a5e65","repo":"gastownhall/beads","slug":"loading-attachment-subgraph-s-w","errorCode":null,"errorMessage":"loading attachment subgraph %s: %w","messagePattern":"loading attachment subgraph (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_proxied_server.go","lineNumber":96,"sourceCode":"\t\t\tissue    *types.Issue\n\t\t\tsubgraph *TemplateSubgraph\n\t\t}\n\t\tvar attachments []attachmentInfo\n\t\tfor _, attachArg := range in.attachArgs {\n\t\t\tattachID, err := utils.ResolvePartialID(ctx, w, attachArg)\n\t\t\tif err != nil {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"resolving attachment ID %s: %w\", attachArg, err)\n\t\t\t}\n\t\t\tattachIssue, err := w.GetIssue(ctx, attachID)\n\t\t\tif err != nil {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"loading attachment %s: %w\", attachID, err)\n\t\t\t}\n\t\t\tif !isProto(attachIssue) {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"%s is not a proto (missing '%s' label)\", attachID, MoleculeLabel)\n\t\t\t}\n\t\t\tattachSubgraph, err := loadTemplateSubgraph(ctx, w, attachID)\n\t\t\tif err != nil {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"loading attachment subgraph %s: %w\", attachID, err)\n\t\t\t}\n\t\t\tattachments = append(attachments, attachmentInfo{attachID, attachIssue, attachSubgraph})\n\t\t}\n\n\t\tvars := applyVariableDefaults(vars, subgraph)\n\n\t\tvar attachSubgraphs []*TemplateSubgraph\n\t\tfor _, a := range attachments {\n\t\t\tattachSubgraphs = append(attachSubgraphs, a.subgraph)\n\t\t}\n\t\tif err := checkPourVars(subgraph, attachSubgraphs, vars); err != nil {\n\t\t\treturn pourProxiedResult{}, \"\", err\n\t\t}\n\n\t\tif in.dryRun {\n\t\t\tvar previews []pourAttachPreview\n\t\t\tfor _, a := range attachments {\n\t\t\t\tpreviews = append(previews, pourAttachPreview{title: a.issue.Title, steps: len(a.subgraph.Issues)})","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_proxied_server.go#L78-L114","documentation":"Wrapped error from loadTemplateSubgraph while fetching the template subgraph of an --attach proto during `bd mol pour`. After the attachment issue itself resolves and loads fine, walking its full child subgraph failed, so the pour transaction aborts before any cloning happens. This is a database/storage-layer failure, not a validation error.","triggerScenarios":"Run `bd mol pour <proto> --attach <id>` where the attachment issue passes isProto() (has the molecule label) but loadTemplateSubgraph(ctx, w, attachID) fails to load its descendant issues — e.g. a DB query error, corrupted dependency links, or a storage connection failure inside the transaction.","commonSituations":"Corrupt or partially-synced Dolt database where dependency rows reference missing issues; the attach target's children were deleted out-of-band; transient storage/driver errors while the UOW transaction is open.","solutions":["Check the wrapped inner error (%w) to see whether it is 'not found' vs a storage error; fix the underlying cause first","Run `bd doctor` to verify database integrity and repair broken dependency references","Re-sync the database: `bd dolt pull` if the attachment molecule was created on another machine","If the attachment molecule is broken and unrecoverable, remove it from the --attach list and recreate the molecule"],"exampleFix":"// before\nbd mol pour bd-123 --attach bd-999   // fails: loading attachment subgraph bd-999: issue not found: bd-1001\n// after\nbd doctor && bd dolt pull            // repair/sync, then retry the pour\nbd mol pour bd-123 --attach bd-999","handlingStrategy":"validation","validationCode":"// Inspect the attachment molecule before pouring\nbd mol show <attachID>\n// Verify all children are present:\nbd list | grep <attachID>","typeGuard":"func isAttachSubgraphLoadable(err error) bool {\n    return err == nil // dry-run the pour first; a nil error means all attachment subgraphs loaded\n}","tryCatchPattern":"if err := runPourProxiedServer(ctx, in); err != nil {\n    var inner error = errors.Unwrap(err)\n    log.Printf(\"attachment subgraph load failed: %v\", inner)\n    // fall back to pouring without the broken attachment\n}","preventionTips":["Run `bd mol pour ... --dry-run` first; it loads every attachment subgraph without side effects","Run `bd doctor` periodically to catch dangling dependency edges early","Keep the database synced (`bd dolt pull`) before molecule operations spanning machines"],"tags":["go","storage","molecule","pour","subgraph"],"backgroundTag":"subgraph-load-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}