{"record":{"id":"30272294d7e3c2f1","repo":"google-gemini/gemini-cli","slug":"failed-to-clean-eval-directory-e","errorCode":null,"errorMessage":"Failed to clean eval directory: {e}","messagePattern":"Failed to clean eval directory: (.+?)","errorType":"exception","errorClass":"OrchestrationError","httpStatus":null,"severity":"error","filePath":"tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py","lineNumber":99,"sourceCode":"            script_dir=prompts_dir,\n        )\n\n    def _setup_workspace(self) -> None:\n        \"\"\"Ensures that required temporary workspace structures are initialized.\"\"\"\n        logging.info(\"Initializing workspace directories...\")\n        os.makedirs(self.config.tmp_dir, exist_ok=True)\n        os.makedirs(self.config.pr_dir, exist_ok=True)\n        os.makedirs(self.config.eval_dir, exist_ok=True)\n\n    def _clean_eval_dir(self) -> None:\n        \"\"\"Cleans up the evaluation workspace directory to prevent state bleeding.\"\"\"\n        logging.info(\"Cleaning up evaluation repository path: %s\", self.config.eval_dir)\n        if os.path.exists(self.config.eval_dir):\n            try:\n                shutil.rmtree(self.config.eval_dir, onerror=_remove_readonly)\n            except OSError as e:\n                logging.error(\"Failed to remove evaluation directory: %s\", e)\n                raise OrchestrationError(f\"Failed to clean eval directory: {e}\") from e\n        os.makedirs(self.config.eval_dir, exist_ok=True)\n\n    def _sync_or_clone_repository(self) -> None:\n        \"\"\"Clones the target git repo or synchronizes it back to clean main branch.\"\"\"\n        git_dir = os.path.join(self.config.pr_repo_path, \".git\")\n        repo_exists = os.path.exists(git_dir)\n\n        if repo_exists:\n            logging.info(\"Repository already exists locally. Syncing with remote origin/main...\")\n            try:\n                CommandExecutor.run([\"git\", \"reset\", \"--hard\", \"HEAD\"], self.config.pr_repo_path)\n                CommandExecutor.run([\"git\", \"clean\", \"-fd\"], self.config.pr_repo_path)\n                CommandExecutor.run([\"git\", \"checkout\", \"main\"], self.config.pr_repo_path)\n                CommandExecutor.run([\"git\", \"pull\", \"origin\", \"main\"], self.config.pr_repo_path)\n            except CommandExecutionError as e:\n                logging.warning(\"Repository sync failed: %s. Re-cloning from scratch.\", e)\n                try:\n                    shutil.rmtree(self.config.pr_repo_path)","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py#L81-L117","documentation":"Error \"Failed to clean eval directory: {e}\" thrown in google-gemini/gemini-cli.","triggerScenarios":"Thrown at tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}