{"record":{"id":"d9765f5b6cf67449","repo":"unslothai/unsloth","slug":"the-parent-folder-does-not-exist","errorCode":null,"errorMessage":"The parent folder does not exist.","messagePattern":"The parent folder does not exist\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/hf_cache_settings.py","lineNumber":272,"sourceCode":"    if resolved.parent == resolved:\n        raise ValueError(\"Choose a folder inside the filesystem or drive root.\")\n    try:\n        from hub.storage.scan_folders import (\n            contains_sensitive_path_component,\n            is_denied_system_path,\n        )\n    except ImportError:\n        contains_sensitive_path_component = is_denied_system_path = None\n    if is_denied_system_path is not None and is_denied_system_path(str(resolved)):\n        raise ValueError(\"System folders cannot be used for model downloads.\")\n    if contains_sensitive_path_component is not None and contains_sensitive_path_component(\n        str(resolved)\n    ):\n        raise ValueError(\"Credential or config folders cannot be used for model downloads.\")\n\n    parent = resolved.parent\n    if not parent.exists() or not parent.is_dir():\n        raise ValueError(\"The parent folder does not exist.\")\n    try:\n        resolved.mkdir(exist_ok = True)\n        if not resolved.is_dir():\n            raise ValueError(\"The selected cache location is not a folder.\")\n        for child in (resolved / \"hub\", resolved / \"xet\"):\n            child.mkdir(exist_ok = True)\n            with tempfile.NamedTemporaryFile(prefix = \".unsloth-write-test-\", dir = child):\n                pass\n    except PermissionError as exc:\n        raise ValueError(\"Studio does not have permission to write to this folder.\") from exc\n    except OSError as exc:\n        raise ValueError(f\"Studio cannot use this cache folder: {exc}\") from exc\n    return resolved\n\n\ndef _stored_history() -> list[Path]:\n    try:\n        from storage.studio_db import get_app_setting","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/hf_cache_settings.py#L254-L290","documentation":"Raised when the parent of the resolved cache folder either does not exist or is not a directory (parent.exists() and parent.is_dir() must both hold). The check runs before mkdir because Path.mkdir only creates the final component; a missing grandparent would otherwise produce a raw FileNotFoundError instead of this friendly message.","triggerScenarios":"set_hf_cache_home('/mnt/missing-volume/hf') where /mnt/missing-volume does not exist, or a path whose parent is actually a file (e.g. someone created a file named 'hf-cache' and you pass '/data/hf-cache/inner'). Also when a USB/network mount is unmounted so the parent path no longer resolves.","commonSituations":"Removable drives that are unplugged between browse and save; network shares not yet mounted at login; typos in intermediate directory names; containers where the volume is mounted at a different path than on the host.","solutions":["Create the parent chain first: mkdir -p /mnt/data/hf-cache, then save the setting","If on a removable/network volume, remount it and confirm with 'ls' that the parent is visible","Fix typos in intermediate path components by re-selecting the folder in the picker"],"exampleFix":"# before\nset_hf_cache_home('/mnt/usb-not-mounted/hf')  # ValueError: parent does not exist\n\n# after (mount the drive first, then)\nmkdir -p /mnt/usb/hf\nset_hf_cache_home('/mnt/usb/hf')              # ok","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef parent_ready(raw: str) -> bool:\n    parent = Path(raw).expanduser().resolve(strict=False).parent\n    return parent.exists() and parent.is_dir()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["mkdir -p the full cache path before saving the setting","Re-validate on save, not just on folder-pick, since mounts can vanish in between"],"tags":["huggingface","cache","filesystem","mount","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}