{"record":{"id":"4f76bbb09581e0b8","repo":"gastownhall/beads","slug":"open-unit-of-work-w","errorCode":null,"errorMessage":"open unit of work: %w","messagePattern":"open unit of work: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/bd/dep_proxied_server.go","lineNumber":118,"sourceCode":"\t\treturn res\n\t}\n\tif checkCycles {\n\t\tres.cycles, res.cycleErr = proxiedCycleReport(ctx)\n\t}\n\tif fromID == \"\" && toID == \"\" {\n\t\treturn res\n\t}\n\n\tif uowProvider == nil {\n\t\tif res.cycleErr == nil {\n\t\t\tres.cycleErr = errors.New(\"proxied-server UOW provider not initialized\")\n\t\t}\n\t\treturn res\n\t}\n\tuw, err := uowProvider.NewUOW(ctx)\n\tif err != nil {\n\t\tif res.cycleErr == nil {\n\t\t\tres.cycleErr = fmt.Errorf(\"open unit of work: %w\", err)\n\t\t}\n\t\treturn res\n\t}\n\tdefer uw.Close(ctx)\n\n\tif fromID != \"\" {\n\t\tres.fromTitle = proxiedLookupTitle(ctx, uw, fromID)\n\t}\n\tif toID != \"\" {\n\t\tres.toTitle = proxiedLookupTitle(ctx, uw, toID)\n\t}\n\treturn res\n}\n\n// proxiedCycleReport runs the post-write sweep on the proxied route through the\n// cycle role, which opens its own read-only unit of work.\nfunc proxiedCycleReport(ctx context.Context) ([]issueops.Cycle, error) {\n\tdetector, err := proxiedCycleDetector()","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/dep_proxied_server.go#L100-L136","documentation":"depEdgeFeedback opens a unit of work (transaction) via uowProvider.NewUOW to look up issue titles after dependency edges were written. If opening the UOW fails, the error is wrapped as 'open unit of work: %w' and stored on depAddResult.cycleErr. Because the edges are already durable at this point, this is a post-write feedback failure: the write succeeded, but cycle sweep results or confirmation titles could not be gathered.","triggerScenarios":"Calling any proxied-server dependency command (bd dep add/remove/blocks, bd link) where uowProvider.NewUOW(ctx) returns an error — e.g. the backing database connection is broken, the server is unreachable, or the store was closed before feedback gathering.","commonSituations":"Database/server connection dropped between the edge write and the feedback read; corrupted or locked Dolt database; running against a proxied server that went down mid-command; unit tests with a provider whose NewUOW always fails.","solutions":["Inspect the wrapped cause (%w) for the underlying NewUOW failure — usually a connection or storage error.","Re-run 'bd doctor' or check that the Dolt database / proxied server is reachable.","Verify the dependency edges actually landed with 'bd show <issue>' before treating the command as failed — the write is durable.","If this recurs, check store initialization and rebuild/repair the workspace database."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"if uowProvider == nil {\n    return errors.New(\"UOW provider not initialized before feedback\")\n}","typeGuard":null,"tryCatchPattern":"res := depEdgeFeedback(ctx, fromID, toID, checkCycles)\nif res.cycleErr != nil {\n    // edges are already durable; log and continue\n    log.Printf(\"post-write feedback failed: %v\", res.cycleErr)\n}","preventionTips":["Treat feedback failures as non-fatal: the edge write has already committed.","Verify database/server connectivity before running batch dependency operations.","Close other processes holding database locks before long bd sessions.","Monitor NewUOW error rates; repeated failures indicate connection or storage decay."],"tags":["go","database","transaction","unit-of-work"],"backgroundTag":"transaction-open-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}