gastownhall/beads · error

buildProxiedServerClientInfo: path %q is not absolute

Error message

buildProxiedServerClientInfo: path %q is not absolute

What it means

buildProxiedServerClientInfo assembles the client-side info for the proxied server (root path, config path, log path). Each supplied path must be absolute because the spawned server process may run with a different working directory; clean() rejects relative paths with this error. Empty paths are allowed and skipped.

Source

Thrown at cmd/bd/init_proxied_server.go:478

	cfg.DoltTeamServer = in.teamServer

	if filepath.IsAbs(cfg.DoltDataDir) {
		cfg.DoltDataDir = ""
	}

	return json.MarshalIndent(cfg, "", "  ")
}

func buildProxiedServerClientInfo(rootPath, configPath, logPath string, port int, idleTimeout time.Duration, external *configfile.ExternalDoltConfig) (*configfile.ProxiedServerClientInfo, error) {
	if rootPath == "" && configPath == "" && logPath == "" && port == 0 && idleTimeout == 0 && external == nil {
		return nil, nil
	}
	clean := func(p string) (string, error) {
		if p == "" {
			return "", nil
		}
		if !filepath.IsAbs(p) {
			return "", fmt.Errorf("buildProxiedServerClientInfo: path %q is not absolute", p)
		}
		return filepath.Clean(p), nil
	}
	rootAbs, err := clean(rootPath)
	if err != nil {
		return nil, err
	}
	configAbs, err := clean(configPath)
	if err != nil {
		return nil, err
	}
	logAbs, err := clean(logPath)
	if err != nil {
		return nil, err
	}
	if external != nil {
		if err := external.Validate(); err != nil {
			return nil, fmt.Errorf("buildProxiedServerClientInfo: %w", err)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Convert all supplied paths to absolute before init, e.g. with filepath.Abs or by prefixing the known root
  2. Have the caller resolve relative paths against the intended root instead of assuming the server's cwd
  3. Check which of rootPath/configPath/logPath was relative from the %q in the error message

Example fix

// before
buildProxiedServerClientInfo("./.bd", cfgPath, logPath, ...)
// error: path "./.bd" is not absolute
// after
root, _ := filepath.Abs("./.bd")
buildProxiedServerClientInfo(root, cfgPath, logPath, ...)
Defensive patterns

Strategy: validation

Validate before calling

func mustAbs(p string) (string, error) {
    if p == "" { return "", nil }
    abs, err := filepath.Abs(p)
    if err != nil { return "", err }
    if !filepath.IsAbs(abs) { return "", fmt.Errorf("path %q not absolute", p) }
    return abs, nil
}

Type guard

func isAbsPath(p string) bool { return p == "" || filepath.IsAbs(p) }

Try / catch

if err != nil && strings.Contains(err.Error(), "is not absolute") {
    var pe *filepathError
    if errors.As(err, &pe) {
        abs, aerr := filepath.Abs(pe.Path)
        if aerr == nil { /* retry with abs */ }
    }
}

Prevention

When it happens

Trigger: Calling bd init (or the code path that builds ProxiedServerClientInfo) with a relative rootPath, configPath, or logPath — e.g. passing "./.bd" or "bd.log" instead of an absolute path.

Common situations: Scripts using relative paths assuming init's cwd; passing $PWD-derived values after a cd; wrappers invoking the internal API with user-typed relative paths.

Related errors


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