{"record":{"id":"df4d678672422f34","repo":"gastownhall/beads","slug":"loading-proto-s-w","errorCode":null,"errorMessage":"loading proto %s: %w","messagePattern":"loading proto (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_proxied_server.go","lineNumber":65,"sourceCode":"\t\t// instead of falling through to the proto-ID lookup below, which\n\t\t// would otherwise mask this as \"not found as formula or proto ID\".\n\t\treturn HandleError(\"%v\", err)\n\t}\n\n\tres, err := uow.RunTxResult(ctx, uowProvider, func(ctx context.Context, uw uow.UnitOfWork) (pourProxiedResult, string, error) {\n\t\tw := newUOWMolWriter(uw)\n\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)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_proxied_server.go#L47-L83","documentation":"After successfully resolving the proto argument to an issue ID, bd mol pour loads the full issue with GetIssue before treating it as a template. This error wraps any failure of that fetch, preserving the cause. Unlike the 'not found as formula or proto' error, the ID resolved but the load failed — usually a storage-level problem or a race where the issue vanished between resolve and load.","triggerScenarios":"Calling `bd mol pour <protoID>` where ResolvePartialID succeeds but the subsequent GetIssue fails: concurrent deletion of the issue, database lock/corruption, context timeout, or wisp-only issues not visible through the normal GetIssue path.","commonSituations":"Another agent/process deleted the proto between resolution and load; Dolt database locked by a concurrent bd command; running on an ephemeral (wisp) proto that GetIssue cannot read.","solutions":["Re-run the pour command — a transient lock or race usually resolves","Verify the proto still exists with bd show <protoID>","Check for concurrent bd processes holding the database lock and wait/retry","If the proto is ephemeral/wisp-only, create it as a persistent (non-wisp) issue"],"exampleFix":"// before: race-prone sequence inside one tx fallback\nprotoID, _ := utils.ResolvePartialID(ctx, w, arg)\nprotoIssue, err := w.GetIssue(ctx, protoID)\n// after: retry transient failures\nprotoIssue, err := w.GetIssue(ctx, protoID)\nif err != nil {\n\tif isTransient(err) { return retry(pour, arg) }\n\treturn fmt.Errorf(\"loading proto %s: %w\", protoID, err)\n}","handlingStrategy":"retry","validationCode":"// verify the resolved proto is loadable before pouring\nprotoID, _ := utils.ResolvePartialID(ctx, reader, protoArg)\nif _, err := reader.GetIssue(ctx, protoID); err != nil {\n\treturn fmt.Errorf(\"proto %s cannot be loaded right now\", protoID)\n}","typeGuard":null,"tryCatchPattern":"err := pourCmd(protoArg)\nif err != nil && strings.HasPrefix(err.Error(), \"loading proto \") {\n\ttime.Sleep(time.Second) // transient storage/race — retry\n\terr = pourCmd(protoArg)\n}","preventionTips":["Avoid deleting protos while pours referencing them are in flight","Serialize molecule operations to avoid concurrent DB locks","Check bd doctor for DB health on repeated load failures","Prefer persistent protos over wisps for templates"],"tags":["go","molecule","storage","race"],"backgroundTag":"database-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}