tensorflow/models · error · FileNotFoundError

Source folder not found

Error message

Source folder not found: {source_folder}

What it means

Raised in get_subfolder_names when the given source_folder does not exist.

Solutions

  1. Verify the source folder path and fix any typo.
  2. Create the folder and populate it with class subfolders if missing.
  3. Check the folder wasn't moved or renamed after a prior stage.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/split_train_val.py:154 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/7afeb4b522417fb8. Report an issue: GitHub.

Appendix: source

Thrown at official/projects/waste_identification_ml/data_generation/auto_labeler_pipeline/split_train_val.py:154


# ── Image discovery and filtering ───────────────────────────────────────────


def get_subfolder_names(source_folder: str) -> list[str]:
  """Returns a sorted list of subfolder names in the source folder.

  Args:
      source_folder: Path to the root source folder.

  Returns:
      A sorted list of subfolder names. Empty list if none found.

  Raises:
      FileNotFoundError: If the source folder does not exist.
  """
  if not os.path.isdir(source_folder):
    raise FileNotFoundError(f"Source folder not found: {source_folder}")

  return [
      name
      for name in sorted(os.listdir(source_folder))
      if os.path.isdir(os.path.join(source_folder, name))
  ]


def get_sorted_image_names(folder_path: str) -> list[str]:
  """Returns a naturally sorted list of image file names from a folder.

  Args:
      folder_path: Path to the folder containing images.

  Returns:
      A naturally sorted list of image file names.
  """
  image_names = [

View on GitHub (pinned to e006f5f0d5)