can1357/oh-my-pi · error · GitCommandError

GitCommandError: git config user.email/user.name failed (non

Error message

GitCommandError: git config user.email/user.name failed (nonzero exit)

What it means

SandboxManager.ensure_workspace() sets the worktree's git commit identity by running `git config user.email` and `git config user.name` in the shared repo dir. If either subprocess exits nonzero, a GitCommandError (RuntimeError subclass carrying cmd, returncode, redacted stdout/stderr) is raised so workspace creation aborts instead of producing commits with a wrong identity.

Source

Thrown at python/robomp/src/sandbox.py:1005

                    branch = current.stdout.strip()
                    if existing_branch is not None and existing_branch != branch:
                        log.warning(
                            "workspace branch mapping %r differs from checked-out branch %r; using checkout",
                            existing_branch,
                            branch,
                        )
            if not workspace_prepared:
                _share_git_metadata_with_slots(repo_dir, slot_uid)
                _provision_runtime_dirs(ws_root)
                _chown_workspace(ws_root, slot_uid)
            if slot_git_env is None:
                slot_git_env = _git_env_for_repo(repo_dir)
            # Identity is set on the worktree's shared config; idempotent. Run as
            # the slot after the chown so git never trips over safe.directory.
            for command in (["git", "config", "user.email", author_email], ["git", "config", "user.name", author_name]):
                proc = _safe_run(command, cwd=repo_dir, env=slot_git_env, **slot_git_kwargs)
                if proc.returncode != 0:
                    raise GitCommandError(command, proc.returncode, proc.stdout, proc.stderr)
            _share_git_metadata_with_slots(repo_dir, slot_uid)
            workspace = Workspace(
                root=ws_root,
                repo_dir=repo_dir,
                session_dir=session_dir,
                context_dir=context_dir,
                artifacts_dir=artifacts_dir,
                branch=branch,
                repo_full_name=repo,
                issue_number=number,
            )
            # Best-effort: hardlink pre-built natives in if we've cached this
            # source state before. Runs AFTER the slot chown so the cache inode
            # keeps its `root:omp` ownership (the slot reads through group `omp`);
            # write-temp + rename in the napi build replaces with a new inode if
            # the agent rebuilds, so the cached file is never mutated.
            self._populate_natives_cache(workspace, slot_uid=slot_uid)
            return workspace

View on GitHub (pinned to 9690622007)

Solutions

  1. Read GitCommandError.stderr (credential-redacted) for the underlying git message — 'fatal: not a git repository' means the clone pool is missing, 'Unable to create ...config.lock' means permissions/disk.
  2. Verify git exists and the repo_dir/.git worktree exists before retrying; run `robomp cleanup owner/repo#N` to reset the workspace.
  3. Fix volume permissions (chown to the slot UID) or free disk space, then let the failed event retry.
  4. If git is missing, rebuild the image with git installed.

Example fix

// before: running ensure_workspace with a read-only /data mount
docker compose up robomp  # -> GitCommandError: git config user.email failed
// after
docker compose down && chown -R $(id -u):$(id -g) ./data && docker compose up robomp
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil, which
if not which('git'): raise RuntimeError('git not installed')
if not (repo_dir / '.git').exists(): raise RuntimeError('repo_dir is not a git worktree')

Type guard

def is_git_command_error(exc: BaseException) -> bool:
    return isinstance(exc, GitCommandError)

Try / catch

from robomp.sandbox import GitCommandError
try:
    ws = manager.ensure_workspace(repo=repo, number=n)
except GitCommandError as e:
    logger.error('workspace git config failed', extra={'cmd': e.cmd, 'rc': e.returncode, 'stderr': e.stderr})
    # fix perms/disk, then retry via the failed event

Prevention

When it happens

Trigger: Calling ensure_workspace() when `git config user.email <email>` or `git config user.name <name>` fails in repo_dir — e.g. repo_dir is not a valid git repo/worktree, the filesystem is read-only or full, the git binary is missing/broken, or the slot git env (slot_git_env/slot_git_kwargs) is malformed.

Common situations: Container images without git installed or with a broken HOME; /data volume mounted read-only; disk-full on the workspace volume; safe.directory/ownership mismatch after a chown step; running outside Docker where the clone pool was never created.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/9f20f7a9e4d6ead1. Report an issue: GitHub.