{"record":{"id":"19159b33756fd2f8","repo":"gastownhall/beads","slug":"setting-dolt-user-name-w-s","errorCode":null,"errorMessage":"setting dolt user.name: %w\n%s","messagePattern":"setting dolt user\\.name: %w\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/doltserver/doltserver.go","lineNumber":1883,"sourceCode":"\t}\n\n\t// Try to get identity from git\n\tgitName := \"beads\"\n\tgitEmail := \"beads@localhost\"\n\n\tif out, err := exec.Command(\"git\", \"config\", \"user.name\").Output(); err == nil {\n\t\tif name := strings.TrimSpace(string(out)); name != \"\" {\n\t\t\tgitName = name\n\t\t}\n\t}\n\tif out, err := exec.Command(\"git\", \"config\", \"user.email\").Output(); err == nil {\n\t\tif email := strings.TrimSpace(string(out)); email != \"\" {\n\t\t\tgitEmail = email\n\t\t}\n\t}\n\n\tif out, err := exec.Command(\"dolt\", \"config\", \"--global\", \"--add\", \"user.name\", gitName).CombinedOutput(); err != nil {\n\t\treturn fmt.Errorf(\"setting dolt user.name: %w\\n%s\", err, out)\n\t}\n\tif out, err := exec.Command(\"dolt\", \"config\", \"--global\", \"--add\", \"user.email\", gitEmail).CombinedOutput(); err != nil {\n\t\treturn fmt.Errorf(\"setting dolt user.email: %w\\n%s\", err, out)\n\t}\n\n\treturn nil\n}\n\n// bdDoltMarker is written after a current bd process creates or acknowledges a\n// local Dolt repository. Its absence in an existing .dolt/ directory indicates\n// the database was created by a pre-0.56 bd version (which used embedded mode).\n// Those databases are incompatible with the current server-only architecture.\nconst bdDoltMarker = \".bd-dolt-ok\"\n\n// MarkDoltDirCompatible writes the canonical bd compatibility marker when\n// doltDir contains a local Dolt repository. It no-ops when there is no .dolt/\n// directory, which lets server and repair paths call it defensively.\nfunc MarkDoltDirCompatible(doltDir string) error {","sourceCodeStart":1865,"sourceCodeEnd":1901,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/doltserver/doltserver.go#L1865-L1901","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify dolt is installed and runnable: `dolt --version`; install it or fix PATH if it fails.","Run the exact command manually — `dolt config --global --add user.name \"your-name\"` — and read dolt's error output appended to this message.","Check $HOME is set and writable (`ls -ld $HOME`); set HOME to a writable dir in containers/CI if not.","If ~/.dolt/config_global.json is corrupt or has bad permissions, remove or fix it, then retry the bd command.","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."],"exampleFix":"// before (Dockerfile: dolt missing from PATH for the bd runtime user)\nUSER app\nRUN bd init\n// after\nUSER app\nENV HOME=/home/app\nENV PATH=/usr/local/dolt:$PATH\nRUN dolt config --global --set user.name \"beads\" && dolt config --global --set user.email \"beads@localhost\"\nRUN bd init","handlingStrategy":"validation","validationCode":"// Pre-check before running bd, so ensureDoltIdentity never hits the failing path\nif !command -v dolt >/dev/null 2>&1; then echo \"dolt not installed\"; exit 1; fi\n[ -w \"$HOME\" ] || { echo \"HOME not writable: $HOME\"; exit 1; }\ndolt config --global --get user.name >/dev/null 2>&1 || dolt config --global --set user.name \"$(git config user.name || echo beads)\"","typeGuard":null,"tryCatchPattern":"// Go caller of ensureDoltIdentity-equivalent: inspect the appended dolt output\nif err := ensureDoltIdentity(); err != nil {\n    var exitErr *exec.ExitError\n    if errors.As(err, &exitErr) {\n        log.Fatalf(\"dolt config failed (exit %d). dolt said: %s\", exitErr.ExitCode(), err)\n    }\n    return err // e.g. exec.ErrNotFound: install dolt / fix PATH\n}","preventionTips":["Pre-seed `dolt config --global user.name`/`user.email` in CI images and Dotfiles so bd never auto-configures.","Always set HOME explicitly in containers; never run bd with an unset or read-only HOME.","Smoke-test `dolt --version` and `dolt config --global --list` in your setup script before bd commands.","Keep the dolt binary on PATH for every user that runs bd."],"tags":["dolt","config","exec","identity"],"backgroundTag":"dolt-config-setup-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}