{"record":{"id":"fda53b396f531de0","repo":"gastownhall/beads","slug":"loading-proto-w-fda53b","errorCode":null,"errorMessage":"loading proto: %w","messagePattern":"loading proto: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_proxied_server.go","lineNumber":72,"sourceCode":"\n\t\tsubgraph := formulaSubgraph\n\t\tprotoID := formulaProtoID\n\t\tif subgraph == nil {\n\t\t\tresolvedID, err := utils.ResolvePartialID(ctx, w, in.protoArg)\n\t\t\tif err != nil {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"%s not found as formula or proto ID\", in.protoArg)\n\t\t\t}\n\t\t\tprotoID = resolvedID\n\t\t\tprotoIssue, err := w.GetIssue(ctx, protoID)\n\t\t\tif err != nil {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"loading proto %s: %w\", protoID, err)\n\t\t\t}\n\t\t\tif !isProto(protoIssue) {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"%s is not a proto (missing '%s' label)\", protoID, MoleculeLabel)\n\t\t\t}\n\t\t\tsubgraph, err = loadTemplateSubgraph(ctx, w, protoID)\n\t\t\tif err != nil {\n\t\t\t\treturn pourProxiedResult{}, \"\", fmt.Errorf(\"loading proto: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\ttype attachmentInfo struct {\n\t\t\tid       string\n\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}","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_proxied_server.go#L54-L90","documentation":"After validating that the resolved issue is a proto, bd mol pour loads its template subgraph (the proto plus its dependent child issues) with loadTemplateSubgraph. This error wraps any failure of that traversal, preserving the cause. It means the proto exists and is labeled correctly but its dependency graph could not be loaded — typically a storage failure or an inconsistent/corrupt dependency graph.","triggerScenarios":"Calling `bd mol pour <protoID>` where loadTemplateSubgraph fails: database errors while reading dependents, a dependency edge pointing to a missing/deleted issue, graph cycles or corrupt dependency rows, or context cancellation mid-traversal.","commonSituations":"A child issue of the proto was deleted without removing the dependency edge (orphaned dependency); database corruption after an interrupted write; very large templates hitting timeouts; sync conflicts producing dangling dependency records.","solutions":["Inspect the wrapped cause for the specific failing step or issue ID","Run bd doctor to detect and repair dangling dependencies/corruption","Re-add or remove the orphaned dependency edge, then retry the pour","Re-create the proto from its formula if the template graph is unrecoverable"],"exampleFix":"// before: hard failure on one bad edge\nsubgraph, err := loadTemplateSubgraph(ctx, w, protoID)\nif err != nil { return fmt.Errorf(\"loading proto: %w\", err) }\n// after: surface the offending dependent ID for repair\nsubgraph, err := loadTemplateSubgraph(ctx, w, protoID)\nif err != nil {\n\tlog.Printf(\"check dependencies of %s (bd doctor)\", protoID)\n\treturn fmt.Errorf(\"loading proto: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// sanity-check the template graph before pouring\ndeps, err := reader.GetDependentsWithMetadata(ctx, protoID)\nif err != nil {\n\treturn fmt.Errorf(\"template graph for %s unreadable: %w\", protoID, err)\n}\nfor _, d := range deps {\n\tif _, err := reader.GetIssue(ctx, d.ID); err != nil {\n\t\treturn fmt.Errorf(\"orphaned dependency on %s\", d.ID)\n\t}\n}","typeGuard":null,"tryCatchPattern":"err := pourCmd(protoID)\nif err != nil && strings.HasPrefix(err.Error(), \"loading proto:\") {\n\t// run `bd doctor` to detect dangling deps / corruption, then retry\n}","preventionTips":["Run bd doctor regularly to catch dangling dependencies","Delete dependents properly (let bd clean up edges) instead of raw DB edits","Avoid interrupting molecule writes mid-transaction","Keep templates modest in size to avoid traversal timeouts"],"tags":["go","molecule","dependency-graph","storage"],"backgroundTag":"template-subgraph-load-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}