gastownhall/beads · error

resolve proxied server root: %w

Error message

resolve proxied server root: %w

What it means

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.

Source

Thrown at cmd/bd/context_cmd.go:147

// that, comparing this against the contextinfo provider the proxied route and
// GET /v0/beads/context both go through.
//
// The identity itself goes through domain.SetBackendIdentity, which is the one
// policy both routes share: it is what stops a non-Dolt workspace from being
// described as embedded Dolt on database "beads", which is what both routes did
// while each held its own copy of `Backend: configfile.BackendDolt`.
func applyContextBackend(snapshot *domain.ContextInfo, beadsDir string, cfg *configfile.Config) error {
	snapshot.SetBackendIdentity(cfg.GetBackend(), cfg.GetDoltMode(), cfg.GetDoltDatabase())
	snapshot.ProjectID = cfg.ProjectID

	if cfg.IsDoltServerMode() {
		snapshot.ServerHost = cfg.GetDoltServerHost()
		snapshot.ServerPort = doltserver.DefaultConfig(beadsDir).Port
	}
	if cfg.IsDoltProxiedServerMode() {
		p, err := resolveProxiedServerRootPath(beadsDir)
		if err != nil {
			return fmt.Errorf("resolve proxied server root: %w", err)
		}
		snapshot.ProxiedDir = p
	}
	if dataDir := cfg.GetDoltDataDir(); dataDir != "" {
		snapshot.DataDir = dataDir
	}
	return nil
}

func printContextText(info ContextInfo) {
	fmt.Printf("bd version:     %s\n", info.BdVersion)
	fmt.Println()

	// Repository
	fmt.Println("Repository:")
	fmt.Printf("  beads dir:    %s\n", info.BeadsDir)
	fmt.Printf("  repo root:    %s\n", info.RepoRoot)
	if info.CWDRepoRoot != "" && info.CWDRepoRoot != info.RepoRoot {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped %w cause and fix it directly (create/restore the missing directory or fix permissions)
  2. Verify the beads directory exists and is the intended one (check BEADS_DIR / config)
  3. Confirm proxied-server mode is intentional; if you do not use a proxied Dolt server, unset the proxied-server config so IsDoltProxiedServerMode() returns false
  4. Re-initialize the workspace (bd init) if the directory tree was moved or copied without server metadata
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling bd context, ensure the beads dir and proxied config exist
if cfg.IsDoltProxiedServerMode() {
  if fi, err := os.Stat(beadsDir); err != nil || !fi.IsDir() {
    return fmt.Errorf("proxied mode configured but beads dir missing: %s", beadsDir)
  }
}

Try / catch

if err := applyContextBackend(...); err != nil {
  var wrapped error
  if errors.As(err, &wrapped) && strings.Contains(err.Error(), "resolve proxied server root") {
    // inspect %w cause: missing dir, permissions, or server metadata
  }
  return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/92c172aacd2824d7. Report an issue: GitHub.