gastownhall/beads · error

sidecar dolt binary %q: resolving absolute path: %w

Error message

sidecar dolt binary %q: resolving absolute path: %w

What it means

Resolve wraps the error from filepath.Abs when it cannot convert the explicitly configured sidecar dolt binary path to an absolute path. filepath.Abs only fails when os.Getwd fails (e.g. the current working directory was deleted), so this is rare and indicates a broken process environment rather than a bad sidecar value. The sidecar source is reported so diagnostics show which precedence level failed.

Source

Thrown at internal/doltversion/resolve.go:131

// binary and launching a different one. filepath.Abs forces both steps to
// agree on the same cwd-relative file in that case.
func Resolve(opts ResolveOptions) (string, Source, error) {
	if opts.EnvValue != "" {
		abs, err := filepath.Abs(opts.EnvValue)
		if err != nil {
			return "", SourceEnv, fmt.Errorf("%s=%q: resolving absolute path: %w", DoltBinEnvVar, opts.EnvValue, err)
		}
		abs = completeExecutableExt(abs)
		if err := validateExplicitPath(abs); err != nil {
			return "", SourceEnv, fmt.Errorf("%s=%q: %w", DoltBinEnvVar, opts.EnvValue, err)
		}
		return abs, SourceEnv, nil
	}

	if opts.SidecarValue != "" {
		abs, err := filepath.Abs(opts.SidecarValue)
		if err != nil {
			return "", SourceSidecar, fmt.Errorf("sidecar dolt binary %q: resolving absolute path: %w", opts.SidecarValue, err)
		}
		abs = completeExecutableExt(abs)
		if err := validateExplicitPath(abs); err != nil {
			return "", SourceSidecar, fmt.Errorf("sidecar dolt binary %q: %w", opts.SidecarValue, err)
		}
		return abs, SourceSidecar, nil
	}

	path, err := exec.LookPath("dolt")
	if err != nil {
		return "", SourcePath, fmt.Errorf("%w: dolt not found on PATH: %v", ErrNotFound, err)
	}
	return path, SourcePath, nil
}

// completeExecutableExt completes a Windows executable extension on an
// explicitly-named path spelled without one: BEADS_DOLT_BIN=C:\tools\dolt
// should find C:\tools\dolt.exe the same way cmd.exe or exec.LookPath

View on GitHub (pinned to 71377f2769)

Solutions

  1. Restart the process from an existing working directory
  2. Check the cwd exists: run pwd / os.Getwd() and recreate it if deleted
  3. If the sidecar value is wrong, fix the clone-local sidecar setting to point at a real dolt binary
  4. Fallback: unset/empty the sidecar value so Resolve proceeds to PATH lookup

Example fix

// before
bd served   # launched from a deleted checkout directory
// after
cd /path/to/existing/repo && bd served
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Getwd(); err != nil {
    return fmt.Errorf("working directory unavailable, cannot resolve sidecar binary: %w", err)
}

Try / catch

path, src, err := doltversion.Resolve(opts)
if err != nil {
    var nf *fs.PathError
    if errors.As(err, &nf) { /* report cwd problem */ }
    return fmt.Errorf("resolving dolt binary: %w", err)
}

Prevention

When it happens

Trigger: Calling Resolve with ResolveOptions.SidecarValue non-empty while the process's working directory has been removed (os.Getwd fails inside filepath.Abs).

Common situations: Running the process after its cwd was deleted (e.g. a temp dir or removed checkout); launching from a container/CI workspace that was cleaned up mid-run.

Related errors


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