{"record":{"id":"92c172aacd2824d7","repo":"gastownhall/beads","slug":"resolve-proxied-server-root-w","errorCode":null,"errorMessage":"resolve proxied server root: %w","messagePattern":"resolve proxied server root: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/context_cmd.go","lineNumber":147,"sourceCode":"// that, comparing this against the contextinfo provider the proxied route and\n// GET /v0/beads/context both go through.\n//\n// The identity itself goes through domain.SetBackendIdentity, which is the one\n// policy both routes share: it is what stops a non-Dolt workspace from being\n// described as embedded Dolt on database \"beads\", which is what both routes did\n// while each held its own copy of `Backend: configfile.BackendDolt`.\nfunc applyContextBackend(snapshot *domain.ContextInfo, beadsDir string, cfg *configfile.Config) error {\n\tsnapshot.SetBackendIdentity(cfg.GetBackend(), cfg.GetDoltMode(), cfg.GetDoltDatabase())\n\tsnapshot.ProjectID = cfg.ProjectID\n\n\tif cfg.IsDoltServerMode() {\n\t\tsnapshot.ServerHost = cfg.GetDoltServerHost()\n\t\tsnapshot.ServerPort = doltserver.DefaultConfig(beadsDir).Port\n\t}\n\tif cfg.IsDoltProxiedServerMode() {\n\t\tp, err := resolveProxiedServerRootPath(beadsDir)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"resolve proxied server root: %w\", err)\n\t\t}\n\t\tsnapshot.ProxiedDir = p\n\t}\n\tif dataDir := cfg.GetDoltDataDir(); dataDir != \"\" {\n\t\tsnapshot.DataDir = dataDir\n\t}\n\treturn nil\n}\n\nfunc printContextText(info ContextInfo) {\n\tfmt.Printf(\"bd version:     %s\\n\", info.BdVersion)\n\tfmt.Println()\n\n\t// Repository\n\tfmt.Println(\"Repository:\")\n\tfmt.Printf(\"  beads dir:    %s\\n\", info.BeadsDir)\n\tfmt.Printf(\"  repo root:    %s\\n\", info.RepoRoot)\n\tif info.CWDRepoRoot != \"\" && info.CWDRepoRoot != info.RepoRoot {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/context_cmd.go#L129-L165","documentation":"applyContextBackend builds a context snapshot for `bd context`. When the config reports Dolt proxied-server mode (cfg.IsDoltProxiedServerMode()), it calls resolveProxiedServerRootPath(beadsDir) to locate the proxied server's data root; any failure is wrapped as 'resolve proxied server root: %w'. The wrapped error (e.g. missing directory, unreadable server metadata) is the real cause; this wrapper only adds the phase context.","triggerScenarios":"Running `bd context` (or directContextSnapshot) while cfg.IsDoltProxiedServerMode() is true and resolveProxiedServerRootPath fails — e.g. the beads directory is missing/renamed, or the proxied-server metadata that pins the server root is absent or unreadable.","commonSituations":"Pointing bd at a project whose .beads dir was deleted or not yet initialized; env/config (BEADS_DIR or config file) switching the repo into proxied mode while the server root from another machine does not exist locally; permission problems after copying a workspace as another user.","solutions":["Read the wrapped %w cause and fix it directly (create/restore the missing directory or fix permissions)","Verify the beads directory exists and is the intended one (check BEADS_DIR / config)","Confirm proxied-server mode is intentional; if you do not use a proxied Dolt server, unset the proxied-server config so IsDoltProxiedServerMode() returns false","Re-initialize the workspace (bd init) if the directory tree was moved or copied without server metadata"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before calling bd context, ensure the beads dir and proxied config exist\nif cfg.IsDoltProxiedServerMode() {\n  if fi, err := os.Stat(beadsDir); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"proxied mode configured but beads dir missing: %s\", beadsDir)\n  }\n}","typeGuard":null,"tryCatchPattern":"if err := applyContextBackend(...); err != nil {\n  var wrapped error\n  if errors.As(err, &wrapped) && strings.Contains(err.Error(), \"resolve proxied server root\") {\n    // inspect %w cause: missing dir, permissions, or server metadata\n  }\n  return err\n}","preventionTips":["Unwrap the %w cause before troubleshooting the wrapper message","Keep BEADS_DIR/config stable; do not move or copy .beads without its server metadata","Disable proxied-server mode if you do not actually run a proxied Dolt server","Verify directory permissions after copying workspaces between users/machines"],"tags":["dolt","proxied-server","filesystem","context-snapshot","error-wrapping"],"backgroundTag":"proxied-server-root-resolution-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}