{"record":{"id":"9f20f7a9e4d6ead1","repo":"can1357/oh-my-pi","slug":"gitcommanderror-git-config-user-email-user-name-f","errorCode":null,"errorMessage":"GitCommandError: git config user.email/user.name failed (nonzero exit)","messagePattern":"GitCommandError: git config user\\.email/user\\.name failed \\(nonzero exit\\)","errorType":"exception","errorClass":"GitCommandError","httpStatus":null,"severity":"error","filePath":"python/robomp/src/sandbox.py","lineNumber":1005,"sourceCode":"                    branch = current.stdout.strip()\n                    if existing_branch is not None and existing_branch != branch:\n                        log.warning(\n                            \"workspace branch mapping %r differs from checked-out branch %r; using checkout\",\n                            existing_branch,\n                            branch,\n                        )\n            if not workspace_prepared:\n                _share_git_metadata_with_slots(repo_dir, slot_uid)\n                _provision_runtime_dirs(ws_root)\n                _chown_workspace(ws_root, slot_uid)\n            if slot_git_env is None:\n                slot_git_env = _git_env_for_repo(repo_dir)\n            # Identity is set on the worktree's shared config; idempotent. Run as\n            # the slot after the chown so git never trips over safe.directory.\n            for command in ([\"git\", \"config\", \"user.email\", author_email], [\"git\", \"config\", \"user.name\", author_name]):\n                proc = _safe_run(command, cwd=repo_dir, env=slot_git_env, **slot_git_kwargs)\n                if proc.returncode != 0:\n                    raise GitCommandError(command, proc.returncode, proc.stdout, proc.stderr)\n            _share_git_metadata_with_slots(repo_dir, slot_uid)\n            workspace = Workspace(\n                root=ws_root,\n                repo_dir=repo_dir,\n                session_dir=session_dir,\n                context_dir=context_dir,\n                artifacts_dir=artifacts_dir,\n                branch=branch,\n                repo_full_name=repo,\n                issue_number=number,\n            )\n            # Best-effort: hardlink pre-built natives in if we've cached this\n            # source state before. Runs AFTER the slot chown so the cache inode\n            # keeps its `root:omp` ownership (the slot reads through group `omp`);\n            # write-temp + rename in the napi build replaces with a new inode if\n            # the agent rebuilds, so the cached file is never mutated.\n            self._populate_natives_cache(workspace, slot_uid=slot_uid)\n            return workspace","sourceCodeStart":987,"sourceCodeEnd":1023,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/robomp/src/sandbox.py#L987-L1023","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Verify git exists and the repo_dir/.git worktree exists before retrying; run `robomp cleanup owner/repo#N` to reset the workspace.","Fix volume permissions (chown to the slot UID) or free disk space, then let the failed event retry.","If git is missing, rebuild the image with git installed."],"exampleFix":"// before: running ensure_workspace with a read-only /data mount\ndocker compose up robomp  # -> GitCommandError: git config user.email failed\n// after\ndocker compose down && chown -R $(id -u):$(id -g) ./data && docker compose up robomp","handlingStrategy":"try-catch","validationCode":"import shutil, which\nif not which('git'): raise RuntimeError('git not installed')\nif not (repo_dir / '.git').exists(): raise RuntimeError('repo_dir is not a git worktree')","typeGuard":"def is_git_command_error(exc: BaseException) -> bool:\n    return isinstance(exc, GitCommandError)","tryCatchPattern":"from robomp.sandbox import GitCommandError\ntry:\n    ws = manager.ensure_workspace(repo=repo, number=n)\nexcept GitCommandError as e:\n    logger.error('workspace git config failed', extra={'cmd': e.cmd, 'rc': e.returncode, 'stderr': e.stderr})\n    # fix perms/disk, then retry via the failed event","preventionTips":["Ensure the container image includes git and /data is writable by the slot UID","Monitor free disk space on the workspace volume","Run `robomp cleanup owner/repo#N` after any manual intervention in /data/workspaces"],"tags":["git","workspace","subprocess","configuration"],"backgroundTag":"git-command-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}