{"record":{"id":"af600d7593fcf055","repo":"Comfy-Org/ComfyUI","slug":"dataset-folder-folder-name-r-not-found-in","errorCode":null,"errorMessage":"Dataset folder {folder_name!r} not found in: {', '.join(roots)}","messagePattern":"Dataset folder (.+?) not found in: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_dataset.py","lineNumber":135,"sourceCode":"    The folder is not created here; callers makedirs after validation.\n    \"\"\"\n    root = folder_paths.get_folder_paths(\"datasets\")[0]\n    target = secure_subfolder_path(root, folder_name)\n    if os.path.realpath(target) == os.path.realpath(root):\n        raise ValueError(\"folder_name must name a subfolder of the datasets directory, e.g. 'my_dataset'.\")\n    return target\n\n\ndef get_dataset_dir(folder_name):\n    \"\"\"Find an existing dataset folder by relative name across all dataset roots.\"\"\"\n    roots = folder_paths.get_folder_paths(\"datasets\")\n    for root in roots:\n        target = secure_subfolder_path(root, folder_name)\n        if os.path.realpath(target) == os.path.realpath(root):\n            raise ValueError(\"folder_name must name a subfolder of the datasets directory, e.g. 'my_dataset'.\")\n        if os.path.isdir(target):\n            return target\n    raise ValueError(f\"Dataset folder {folder_name!r} not found in: {', '.join(roots)}\")\n\n\nVALID_VIDEO_EXTENSIONS = [\".mp4\", \".avi\", \".mov\", \".webm\", \".mkv\", \".flv\"]\n\n\ndef _decode_selected_frames(video: Input.Video, indices: list[int]) -> Input.Video:\n    \"\"\"Decode only the requested frame indices from a video.\n\n    Opens the underlying container once, decodes frames in presentation order,\n    keeps only the ones whose index is in ``indices``, and returns the result\n    wrapped in a VideoFromComponents so it still satisfies the VideoInput\n    contract for downstream nodes.\n    \"\"\"\n    indices_sorted = sorted(set(indices))\n    max_idx = indices_sorted[-1]\n    source = video.get_stream_source()\n\n    frames_by_idx: dict[int, torch.Tensor] = {}","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_dataset.py#L117-L153","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the roots listed in the error message and confirm your dataset folder sits under one of them.","Fix the folder name to exactly match the on-disk directory (watch case and spaces).","Register additional dataset roots via extra_model_paths.yaml [[datasets]] entries if your data lives elsewhere.","Create/download the dataset first if it simply doesn't exist yet."],"exampleFix":"# before\nfolder_name = \"My_Dataset\"  # on-disk: my_dataset\n# after\nfolder_name = \"my_dataset\"","handlingStrategy":"validation","validationCode":"def existing_dataset(name):\n    for root in folder_paths.get_folder_paths(\"datasets\"):\n        cand = os.path.join(root, name)\n        if os.path.isdir(cand):\n            return cand\n    raise FileNotFoundError(f\"dataset {name!r} not under any root\")","typeGuard":"def dataset_exists(name) -> bool:\n    return any(os.path.isdir(os.path.join(r, name)) for r in folder_paths.get_folder_paths(\"datasets\"))","tryCatchPattern":"try:\n    d = get_dataset_dir(name)\nexcept ValueError as e:\n    if \"not found\" in str(e):\n        name = suggest_closest(name)  # fuzzy-match against list_dataset_folders()\n        d = get_dataset_dir(name)\n    else:\n        raise","preventionTips":["Use list_dataset_folders() to populate UI choices.","Match on-disk casing exactly on case-sensitive filesystems.","Register custom dataset roots in extra_model_paths.yaml."],"tags":["dataset","not-found","filesystem","comfyui"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}