gastownhall/beads · error

uow: resolving dolt bin exec: %w

Error message

uow: resolving dolt bin exec: %w

What it means

filepath.Abs failed while converting doltBinExec to an absolute path. As with the server root dir, this only fails when the process cannot determine its current working directory. The binary path is absolutized so the proxy can exec it regardless of later cwd changes.

Source

Thrown at internal/storage/uow/doltserver_provider.go:54

		return nil, fmt.Errorf("uow: database name must not be empty (caller should default to %q)", "beads")
	}
	if err := backend.Validate(); err != nil {
		return nil, fmt.Errorf("uow: backend: %w", err)
	}
	if rootUser == "" {
		return nil, fmt.Errorf("uow: rootUser must not be empty")
	}
	if doltBinExec == "" {
		return nil, fmt.Errorf("uow: doltBinExec must not be empty")
	}

	absServerRootDir, err := filepath.Abs(serverRootDir)
	if err != nil {
		return nil, fmt.Errorf("uow: resolving server root dir: %w", err)
	}
	absDoltBinExec, err := filepath.Abs(doltBinExec)
	if err != nil {
		return nil, fmt.Errorf("uow: resolving dolt bin exec: %w", err)
	}

	if err := os.MkdirAll(absServerRootDir, config.BeadsDirPerm); err != nil {
		return nil, fmt.Errorf("uow: creating server root directory: %w", err)
	}

	ep, err := proxy.GetCreateDatabaseProxyServerEndpoint(absServerRootDir, proxy.OpenOpts{
		Backend:        backend,
		ConfigFilePath: serverConfigFilePath,
		LogFilePath:    serverLogFilePath,
		DoltBinPath:    absDoltBinExec,
		Database:       database,
		IdleTimeout:    idleTimeout,
		Port:           proxyPort,
	})
	if err != nil {
		return nil, fmt.Errorf("uow: get proxy endpoint: %w", err)
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Pass an absolute path to the dolt binary (e.g. from exec.LookPath resolved against a valid cwd)
  2. Ensure the process starts in an existing directory
  3. Restore permissions on the cwd

Example fix

// before
prov, err := NewDoltServerUOWProvider(..., "./bin/dolt", ...)
// after
doltBin, err := filepath.Abs("./bin/dolt")
if err != nil { return err }
prov, err := NewDoltServerUOWProvider(..., doltBin, ...)
Defensive patterns

Strategy: validation

Validate before calling

if !filepath.IsAbs(doltBinExec) {
    abs, err := filepath.Abs(doltBinExec)
    if err != nil { return fmt.Errorf("cannot resolve dolt bin path (cwd unreadable?): %w", err) }
    doltBinExec = abs
}

Type guard

func isUsableBinPath(p string) bool {
    abs, err := filepath.Abs(p)
    return err == nil && abs != ""
}

Try / catch

prov, err := NewDoltServerUOWProvider(...)
if err != nil && strings.Contains(err.Error(), "resolving dolt bin exec") {
    os.Chdir("/")
    prov, err = NewDoltServerUOWProvider(...)
}

Prevention

When it happens

Trigger: Calling NewDoltServerUOWProvider with a relative doltBinExec while os.Getwd() fails due to a deleted or unreadable current directory.

Common situations: Same as the server-root-dir variant: deleted cwd in long-running daemons, container cleanup, or permission revocation.

Related errors


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