{"record":{"id":"97d116206fabd9d4","repo":"gastownhall/beads","slug":"proxied-server-uow-provider-not-initialized-97d116","errorCode":null,"errorMessage":"proxied-server UOW provider not initialized","messagePattern":"proxied-server UOW provider not initialized","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mutate_proxied_server.go","lineNumber":19,"sourceCode":"package main\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\n\t\"github.com/steveyegge/beads/internal/storage\"\n\t\"github.com/steveyegge/beads/internal/storage/uow\"\n\t\"github.com/steveyegge/beads/internal/types\"\n\t\"github.com/steveyegge/beads/internal/ui\"\n\t\"github.com/steveyegge/beads/internal/validation\"\n\t\"github.com/steveyegge/beads/internal/workapi\"\n\t\"github.com/steveyegge/beads/issueops\"\n)\n\nfunc proxiedMutateIssue(ctx context.Context, id, commitMsg string, mutate func(ctx context.Context, uw uow.UnitOfWork, issue *types.Issue, isWisp bool) error) (*types.Issue, error) {\n\tif uowProvider == nil {\n\t\treturn nil, fmt.Errorf(\"proxied-server UOW provider not initialized\")\n\t}\n\tvar updated *types.Issue\n\terr := uow.RunTx(ctx, uowProvider, func(ctx context.Context, uw uow.UnitOfWork) (string, error) {\n\t\tissue, isWisp, rerr := workapi.GetIssueOrWisp(ctx, workapi.NewUOWDetailSource(uw), id)\n\t\tif errors.Is(rerr, storage.ErrNotFound) {\n\t\t\treturn \"\", fmt.Errorf(\"issue %s not found\", id)\n\t\t}\n\t\tif rerr != nil {\n\t\t\treturn \"\", fmt.Errorf(\"resolving %s: %w\", id, rerr)\n\t\t}\n\t\tif err := validateIssueUpdatable(id, issue); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif err := mutate(ctx, uw, issue, isWisp); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif isWisp {\n\t\t\tupdated, _ = uw.IssueUseCase().GetWisp(ctx, issue.ID)","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mutate_proxied_server.go#L1-L37","documentation":"proxiedMutateIssue is the proxied-server path for mutating an issue inside a unit-of-work transaction. It depends on the package-level uowProvider being initialized during server startup. If it is nil, the server was never wired to a UOW provider, so no mutation can be executed and this error is returned instead of panicking.","triggerScenarios":"Any proxied mutation path — proxiedUpdateIssueFields or `bd note` via runNoteProxiedServer — executing when the proxied server process was constructed without calling the uowProvider initialization (nil package variable).","commonSituations":"Embedding/starting the bd proxied server in a custom bootstrap that skips UOW provider setup; calling mutation handlers before server initialization completes; refactor removing initialization code.","solutions":["Ensure the proxied-server startup path initializes uowProvider before serving requests.","If running a standard `bd` server, restart via the official entrypoint (e.g. `bd serve`/proxy mode) rather than custom code.","If embedding, add the UOW provider setup (storage-backed uow provider) to your server bootstrap before handling requests."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Embedders: assert wiring before calling proxied mutations\nif uowProvider == nil {\n    return errors.New(\"server bootstrap incomplete: initialize uowProvider before handling mutations\")\n}","typeGuard":null,"tryCatchPattern":"issue, err := proxiedMutateIssue(ctx, id, msg, mutate)\nif err != nil && strings.Contains(err.Error(), \"UOW provider not initialized\") {\n    // re-initialize server or fall back to direct (non-proxied) mutation path\n}","preventionTips":["Always start the proxied server through its official entrypoint","In embedded setups, initialize uowProvider as the first bootstrap step","Add a startup assertion/log if uowProvider is nil when serving begins","Cover server bootstrap in tests so missing wiring fails fast"],"tags":["go","server","initialization","uow"],"backgroundTag":"dependency-not-initialized","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}