{"record":{"id":"71c257465b8a2735","repo":"can1357/oh-my-pi","slug":"gitcommanderror-workspace-reset-command-failed-n","errorCode":null,"errorMessage":"GitCommandError: workspace reset command failed (nonzero exit)","messagePattern":"GitCommandError: workspace reset command failed \\(nonzero exit\\)","errorType":"exception","errorClass":"GitCommandError","httpStatus":null,"severity":"error","filePath":"python/robomp/src/sandbox.py","lineNumber":1088,"sourceCode":"                    repo_dir=repo_dir,\n                )\n\n            _share_git_metadata_with_slots(repo_dir, slot_uid)\n            _provision_runtime_dirs(ws_root)\n            _chown_workspace(ws_root, slot_uid)\n            slot_git_kwargs = _slot_subprocess_kwargs(slot_uid)\n            slot_git_env = _git_env_for_repo(repo_dir)\n            commands = (\n                [\"git\", \"checkout\", \"-B\", default_branch, f\"origin/{default_branch}\"],\n                [\"git\", \"reset\", \"--hard\", f\"origin/{default_branch}\"],\n                [\"git\", \"clean\", \"-fd\"],\n                [\"git\", \"config\", \"user.email\", author_email],\n                [\"git\", \"config\", \"user.name\", author_name],\n            )\n            for command in commands:\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=default_branch,\n                repo_full_name=repo,\n                issue_number=\"release\",\n            )\n            self._populate_natives_cache(workspace, slot_uid=slot_uid)\n            return workspace\n\n    def _populate_natives_cache(self, workspace: Workspace, *, slot_uid: int | None = None) -> None:\n        \"\"\"Try to hardlink cached pi-natives artifacts into the worktree.\n\n        Best-effort: any failure (no cache configured, non-git worktree,","sourceCodeStart":1070,"sourceCodeEnd":1106,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/robomp/src/sandbox.py#L1070-L1106","documentation":"In ensure_release_workspace(), after detaching, the release workspace runs its reset/config command list (including `git config user.email/user.name`) via _safe_run; any nonzero exit raises GitCommandError so a half-configured release workspace is never returned.","triggerScenarios":"Calling ensure_release_workspace() when any command in the reset list fails in repo_dir — checkout/reset against a dirty or locked worktree, config write failure, or missing git.","commonSituations":"Leftover untracked/locked files in the release worktree from a previously failed run; stale index.lock after a container crash; read-only or full /data volume; slot git env misconfiguration.","solutions":["Read GitCommandError.stderr for the failing command (the cmd is stored on the exception).","Run `robomp cleanup owner/repo#release` (remove_workspace) to delete the poisoned release workspace, then retry.","Remove any stale .git/index.lock inside the release worktree if stderr mentions it.","Check /data volume writability and free space before retrying."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if not (repo_dir / '.git').exists():\n    raise RuntimeError('release worktree missing; run robomp cleanup first')","typeGuard":"def is_git_command_error(exc: BaseException) -> bool:\n    return isinstance(exc, GitCommandError)","tryCatchPattern":"try:\n    ws = manager.ensure_release_workspace(repo=repo, tag=tag)\nexcept GitCommandError as e:\n    manager.remove_workspace(repo=repo, number='release')  # reset poisoned workspace\n    raise","preventionTips":["Run `robomp cleanup owner/repo#release` between manual interventions","Keep /data writable and have free space; check for index.lock leftovers","Avoid killing the container mid-provisioning (use graceful stop)"],"tags":["git","workspace","reset","release"],"backgroundTag":"git-command-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}