gastownhall/beads · error

setting dolt user.name: %w %s

Error message

setting dolt user.name: %w
%s

What it means

bd wraps the failure of the external command `dolt config --global --add user.name <name>` while bootstrapping a Dolt identity for the local repository (ensureDoltIdentity in internal/doltserver/doltserver.go:1882). The wrapped error is the exec.ExitError (non-zero exit or start failure) and the appended %s is dolt's combined stderr/stdout. bd runs this only when no global dolt user.name exists, falling back to git config values or the defaults 'beads'/'beads@localhost'.

Source

Thrown at internal/doltserver/doltserver.go:1883

	}

	// Try to get identity from git
	gitName := "beads"
	gitEmail := "beads@localhost"

	if out, err := exec.Command("git", "config", "user.name").Output(); err == nil {
		if name := strings.TrimSpace(string(out)); name != "" {
			gitName = name
		}
	}
	if out, err := exec.Command("git", "config", "user.email").Output(); err == nil {
		if email := strings.TrimSpace(string(out)); email != "" {
			gitEmail = email
		}
	}

	if out, err := exec.Command("dolt", "config", "--global", "--add", "user.name", gitName).CombinedOutput(); err != nil {
		return fmt.Errorf("setting dolt user.name: %w\n%s", err, out)
	}
	if out, err := exec.Command("dolt", "config", "--global", "--add", "user.email", gitEmail).CombinedOutput(); err != nil {
		return fmt.Errorf("setting dolt user.email: %w\n%s", err, out)
	}

	return nil
}

// bdDoltMarker is written after a current bd process creates or acknowledges a
// local Dolt repository. Its absence in an existing .dolt/ directory indicates
// the database was created by a pre-0.56 bd version (which used embedded mode).
// Those databases are incompatible with the current server-only architecture.
const bdDoltMarker = ".bd-dolt-ok"

// MarkDoltDirCompatible writes the canonical bd compatibility marker when
// doltDir contains a local Dolt repository. It no-ops when there is no .dolt/
// directory, which lets server and repair paths call it defensively.
func MarkDoltDirCompatible(doltDir string) error {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Verify dolt is installed and runnable: `dolt --version`; install it or fix PATH if it fails.
  2. Run the exact command manually — `dolt config --global --add user.name "your-name"` — and read dolt's error output appended to this message.
  3. Check $HOME is set and writable (`ls -ld $HOME`); set HOME to a writable dir in containers/CI if not.
  4. If ~/.dolt/config_global.json is corrupt or has bad permissions, remove or fix it, then retry the bd command.
  5. As a workaround, pre-seed the identity yourself with `dolt config --global --set user.name "..."` so ensureDoltIdentity short-circuits and never runs the failing command.

Example fix

// before (Dockerfile: dolt missing from PATH for the bd runtime user)
USER app
RUN bd init
// after
USER app
ENV HOME=/home/app
ENV PATH=/usr/local/dolt:$PATH
RUN dolt config --global --set user.name "beads" && dolt config --global --set user.email "beads@localhost"
RUN bd init
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check before running bd, so ensureDoltIdentity never hits the failing path
if !command -v dolt >/dev/null 2>&1; then echo "dolt not installed"; exit 1; fi
[ -w "$HOME" ] || { echo "HOME not writable: $HOME"; exit 1; }
dolt config --global --get user.name >/dev/null 2>&1 || dolt config --global --set user.name "$(git config user.name || echo beads)"

Try / catch

// Go caller of ensureDoltIdentity-equivalent: inspect the appended dolt output
if err := ensureDoltIdentity(); err != nil {
    var exitErr *exec.ExitError
    if errors.As(err, &exitErr) {
        log.Fatalf("dolt config failed (exit %d). dolt said: %s", exitErr.ExitCode(), err)
    }
    return err // e.g. exec.ErrNotFound: install dolt / fix PATH
}

Prevention

When it happens

Trigger: Running any bd command that initializes or connects to a local Dolt database when dolt global user.name is unset AND `dolt config --global --add user.name ...` exits non-zero — e.g. the dolt binary is missing from PATH (exec: not found), $HOME is not writable so the global config file can't be created, a stale/corrupt ~/.dolt/config_global.json exists, or dolt rejects the value.

Common situations: CI containers running as non-root with unwritable HOME; dolt not installed or not on PATH; read-only home directories; locked or malformed global dolt config left by a crashed process; SELinux/NFS permission problems on $HOME.

Related errors


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