{"record":{"id":"c3ee50b6cf3b612e","repo":"tensorflow/models","slug":"classifier-output-directory-already-exists-class","errorCode":null,"errorMessage":"Classifier output directory already exists: {classifier_output_dir}. Remove or rename it before re-running.","messagePattern":"Classifier output 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/segmentation.py","lineNumber":212,"sourceCode":"          f\"{input_dir}\"\n      )\n\n    validated.append((dataset_name, input_dir))\n\n  return validated\n\n\ndef validate_classifier_output_dir(classifier_output_dir: str) -> None:\n  \"\"\"Ensures the classifier output directory does not already exist.\n\n  Args:\n      classifier_output_dir: Path to the classifier dataset directory.\n\n  Raises:\n      FileExistsError: If the classifier output directory already exists.\n  \"\"\"\n  if os.path.exists(classifier_output_dir):\n    raise FileExistsError(\n        \"Classifier output directory already exists: \"\n        f\"{classifier_output_dir}. Remove or rename it before re-running.\"\n    )\n\n\n# ── Variant helpers ───────────────────────────────────────────────────────────\n\n\ndef build_variant_directories(\n    class_folder: str, variants: tuple[str, ...]\n) -> dict[str, str]:\n  \"\"\"Creates output directories for each selected variant under a class folder.\n\n  When only one variant is selected, the output directory is the class\n  folder itself (flat layout). When multiple variants are selected, each\n  variant gets its own subdirectory under the class folder.\n\n  Args:","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py#L194-L230","documentation":"Raised in validate_classifier_output_dir when the classifier output directory already exists; existing outputs must be removed or renamed before re-running.","triggerScenarios":"Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/segmentation.py:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove or rename the existing classifier output directory, then re-run.","Back up the previous output if it is still needed.","Choose a fresh output directory for the new run."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}