Comfy-Org/ComfyUI · error · ValueError

Dataset folder {folder_name!r} not found in: {', '.join(root

Error message

Dataset folder {folder_name!r} not found in: {', '.join(roots)}

What it means

When get_dataset_dir finds no existing directory matching folder_name in any configured datasets root, it raises this listing every root it searched. The message doubles as diagnostics: it shows both the requested name and the actual search paths, so users can immediately see whether the name is wrong or the root is not configured.

Source

Thrown at comfy_extras/nodes_dataset.py:135

    The folder is not created here; callers makedirs after validation.
    """
    root = folder_paths.get_folder_paths("datasets")[0]
    target = secure_subfolder_path(root, folder_name)
    if os.path.realpath(target) == os.path.realpath(root):
        raise ValueError("folder_name must name a subfolder of the datasets directory, e.g. 'my_dataset'.")
    return target


def get_dataset_dir(folder_name):
    """Find an existing dataset folder by relative name across all dataset roots."""
    roots = folder_paths.get_folder_paths("datasets")
    for root in roots:
        target = secure_subfolder_path(root, folder_name)
        if os.path.realpath(target) == os.path.realpath(root):
            raise ValueError("folder_name must name a subfolder of the datasets directory, e.g. 'my_dataset'.")
        if os.path.isdir(target):
            return target
    raise ValueError(f"Dataset folder {folder_name!r} not found in: {', '.join(roots)}")


VALID_VIDEO_EXTENSIONS = [".mp4", ".avi", ".mov", ".webm", ".mkv", ".flv"]


def _decode_selected_frames(video: Input.Video, indices: list[int]) -> Input.Video:
    """Decode only the requested frame indices from a video.

    Opens the underlying container once, decodes frames in presentation order,
    keeps only the ones whose index is in ``indices``, and returns the result
    wrapped in a VideoFromComponents so it still satisfies the VideoInput
    contract for downstream nodes.
    """
    indices_sorted = sorted(set(indices))
    max_idx = indices_sorted[-1]
    source = video.get_stream_source()

    frames_by_idx: dict[int, torch.Tensor] = {}

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Check the roots listed in the error message and confirm your dataset folder sits under one of them.
  2. Fix the folder name to exactly match the on-disk directory (watch case and spaces).
  3. Register additional dataset roots via extra_model_paths.yaml [[datasets]] entries if your data lives elsewhere.
  4. Create/download the dataset first if it simply doesn't exist yet.

Example fix

# before
folder_name = "My_Dataset"  # on-disk: my_dataset
# after
folder_name = "my_dataset"
Defensive patterns

Strategy: validation

Validate before calling

def existing_dataset(name):
    for root in folder_paths.get_folder_paths("datasets"):
        cand = os.path.join(root, name)
        if os.path.isdir(cand):
            return cand
    raise FileNotFoundError(f"dataset {name!r} not under any root")

Type guard

def dataset_exists(name) -> bool:
    return any(os.path.isdir(os.path.join(r, name)) for r in folder_paths.get_folder_paths("datasets"))

Try / catch

try:
    d = get_dataset_dir(name)
except ValueError as e:
    if "not found" in str(e):
        name = suggest_closest(name)  # fuzzy-match against list_dataset_folders()
        d = get_dataset_dir(name)
    else:
        raise

Prevention

When it happens

Trigger: Requesting a dataset name that doesn't exist (typo, wrong case on case-sensitive filesystems), or running before the dataset was downloaded/created, or when the datasets extra path is not registered so only the default root is searched.

Common situations: Dataset not yet downloaded; extra_model_paths.yaml missing or mispointed so the custom datasets root isn't in the search list; name mismatch like 'My_Dataset' vs 'my_dataset' on Linux.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/af600d7593fcf055. Report an issue: GitHub.