{"record":{"id":"462bac1e0bdad779","repo":"tensorflow/models","slug":"rejected-directory-already-exists-rejected-dir","errorCode":null,"errorMessage":"Rejected directory already exists: {rejected_dir}. Remove or rename it before re-running.","messagePattern":"Rejected directory already exists: (.+?)\\. Remove or rename it before re-running\\.","errorType":"exception","errorClass":"FileExistsError","httpStatus":null,"severity":"error","filePath":"official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/filter_sparse_images.py","lineNumber":213,"sourceCode":"          f\"{images_dir}\"\n      )\n\n    validated.append((dataset_name, images_dir))\n\n  return validated\n\n\ndef validate_rejected_dir(rejected_dir: str) -> None:\n  \"\"\"Ensures the rejected directory does not already exist.\n\n  Args:\n      rejected_dir: Path to the rejected directory.\n\n  Raises:\n      FileExistsError: If ``rejected_dir`` already exists.\n  \"\"\"\n  if os.path.exists(rejected_dir):\n    raise FileExistsError(\n        f\"Rejected directory already exists: {rejected_dir}. \"\n        \"Remove or rename it before re-running.\"\n    )\n\n\n# ── Filesystem helpers ────────────────────────────────────────────────────────\n\n\ndef gather_image_paths(root_directory: str) -> list[str]:\n  \"\"\"Recursively collects image file paths under a directory.\n\n  Args:\n      root_directory: Directory to walk.\n\n  Returns:\n      A naturally sorted list of absolute image file paths whose extensions\n      (lower-cased) are in ``IMAGE_EXTENSIONS``.\n  \"\"\"","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/filter_sparse_images.py#L195-L231","documentation":"Error \"Rejected directory already exists: {rejected_dir}. Remove or rename it before re-running.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/filter_sparse_images.py:213 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":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}