{"record":{"id":"96e33186a383ed5c","repo":"gastownhall/beads","slug":"proxied-server-uow-provider-not-initialized-96e331","errorCode":null,"errorMessage":"proxied-server UOW provider not initialized","messagePattern":"proxied-server UOW provider not initialized","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/import_proxied_server.go","lineNumber":50,"sourceCode":"// parsed records. It mirrors runImportRecordsClassic stage for stage — dedup,\n// dry-run classification, stale pre-filter, batch write, issue_prefix\n// reconciliation — through the SAME classification and reporting code, with\n// two deliberate structural differences:\n//\n//   - ONE COMMIT PER INVOCATION. The classic path chunks a large import into\n//     bounded transactions (a SQLite write-lock fairness measure) and commits\n//     the issue_prefix sync separately; the proxied path has no PostRun\n//     auto-commit and the whole import — rows, memories, prefix sync — lands\n//     in ONE unit of work with ONE history entry, the Importer capability's\n//     contract.\n//\n//   - The stale guard keeps its classic two-half shape: the pre-filter runs in\n//     its own read (reporting StaleSkippedIDs and keeping stale rows' aux data\n//     out of the batch), and RejectStaleUpserts re-checks updated_at inside\n//     the write transaction, closing the same race the classic path closes.\nfunc runImportRecordsProxied(ctx context.Context, issues []*types.Issue, memories []memoryRecord, source string) error {\n\tif uowProvider == nil {\n\t\treturn fmt.Errorf(\"proxied-server UOW provider not initialized\")\n\t}\n\n\t// Dedup: skip issues whose title matches an existing open issue.\n\tdedupHits := 0\n\tif importDedup && len(issues) > 0 {\n\t\ttype dedupOutcome struct {\n\t\t\tkept []*types.Issue\n\t\t\thits int\n\t\t}\n\t\tout, err := uow.RunTxRead(ctx, uowProvider, func(ctx context.Context, uw uow.UnitOfWork) (dedupOutcome, error) {\n\t\t\tkept, hits := filterDuplicatesByTitle(ctx, uowImportTitleSearcher{uw: uw}, issues)\n\t\t\treturn dedupOutcome{kept: kept, hits: hits}, nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tissues = out.kept\n\t\tdedupHits = out.hits","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/import_proxied_server.go#L32-L68","documentation":"bd's proxied-server import path requires a unit-of-work (UOW) provider that is created during command startup when running against a proxied server. runImportRecordsProxied checks `uowProvider == nil` before touching it; if the provider was never constructed, the import aborts rather than silently proceeding without a transactional backend. This is an internal initialization invariant, not a user-data problem.","triggerScenarios":"Running `bd import` through the proxied-server path where the daemon/provider bootstrap failed, was skipped, or the command was invoked through a code path (or embedder) that never called the provider setup before reaching runImportRecordsProxied.","commonSituations":"The proxied daemon is not running or the proxy handshake failed so provider setup bailed early; an embedder or custom harness invokes the import function directly without initializing uowProvider; a version mismatch where the import path was refactored but the initialization step wasn't wired in.","solutions":["Verify the proxied-server daemon is running and `bd` can connect (check `bd doctor` / daemon logs) so startup provider initialization completes.","Re-run the command; transient bootstrap failures are resolved by a fresh invocation.","If embedding/invoking programmatically, ensure the storage/UOW provider is initialized before calling import, mirroring the standard command startup.","Check for version skew between bd client and proxied server and upgrade to matching versions."],"exampleFix":"// before (embedded/harness use)\nrunImportRecordsProxied(ctx, issues, memories, source) // uowProvider still nil\n// after\nuowProvider = initUOWProvider(cfg) // run normal startup initialization first\nif err := runImportRecordsProxied(ctx, issues, memories, source); err != nil { ... }","handlingStrategy":"validation","validationCode":"if uowProvider == nil {\n    return errors.New(\"storage provider not initialized: run provider bootstrap before import\")\n}","typeGuard":"func providerReady(p uow.Provider) bool { return p != nil }\nif _, ok := uowProvider.(uow.ImporterSource); !ok {\n    return errors.New(\"provider does not offer import surface\")\n}","tryCatchPattern":null,"preventionTips":["Always initialize the storage/UOW provider at command startup before any subcommand runs.","Use `bd doctor` to verify the daemon/provider is healthy before scripted imports.","When embedding, mirror the standard command bootstrap instead of calling import functions directly.","Keep client and proxied-server versions aligned."],"tags":["initialization","storage","proxied-server"],"backgroundTag":"uow-provider-not-initialized","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}