unslothai/unsloth · warning · ValueError
Path does not exist
Error message
Path does not exist
What it means
Validation error from add_scan_folder_with_status: the normalized path (after expanduser + realpath) does not exist on disk. realpath does not require existence, so this check catches typos, moved directories, and unmounted volumes before they enter the scan-folders DB.
Source
Thrown at studio/backend/hub/storage/scan_folders.py:125
conn = get_connection()
try:
_ensure_schema(conn)
rows = conn.execute(
"SELECT id, path, created_at FROM scan_folders ORDER BY created_at"
).fetchall()
return [dict(row) for row in rows]
finally:
conn.close()
def add_scan_folder_with_status(path: str) -> tuple[dict, bool]:
"""Add a readable scan folder and return its row plus whether it was inserted."""
if not path or not path.strip():
raise ValueError("Path cannot be empty")
normalized = os.path.realpath(os.path.expanduser(normalize_path(path.strip())))
if not os.path.exists(normalized):
raise ValueError("Path does not exist")
if not os.path.isdir(normalized):
raise ValueError("Path must be a directory, not a file")
if not os.access(normalized, os.R_OK | os.X_OK):
raise ValueError("Path is not readable")
if is_local_filesystem_root(normalized):
# A local fs root ("/", "C:\\") would expose denied system dirs via browse;
# a UNC share root (\\server\share) has none under it and stays registerable.
raise ValueError("The filesystem root cannot be registered")
if _contains_sensitive_path_component(normalized):
raise ValueError("Credential or configuration directories are not allowed")
is_win = platform.system() == "Windows"
check = os.path.normcase(normalized) if is_win else normalized
for prefix in _denied_path_prefixes():
if check == prefix or check.startswith(prefix + os.sep):
if prefix == "/run" and is_linux_run_media_path(check):
continue
raise ValueError(f"Path under {prefix} is not allowed")View on GitHub (pinned to 203007d190)
Solutions
- Verify the path exists as the same user the backend runs as: `sudo -u <backend-user> ls <path>`.
- Fix typos in the submitted path.
- Mount the volume first, then register the folder.
Defensive patterns
Strategy: validation
Validate before calling
import os
def folder_exists(path: str) -> bool:
return os.path.isdir(os.path.realpath(os.path.expanduser(path.strip()))) Prevention
- Verify the folder exists as the backend service user before registering it.
- Register folders only after their volume is mounted (e.g. after the mount unit, in systemd After=).
- Re-check existence on UI load since folders can disappear between sessions.
When it happens
Trigger: Registering a folder that was deleted/renamed; a typo like /dat/models instead of /data/models; a mount point whose volume is not mounted; using ~user for a user that does not exist.
Common situations: External drive unplugged; NAS share not mounted at boot before studio starts; paths copy-pasted from another machine.
Related errors
- Execution artifact path is not a dataset folder.
- Local base_repo is not a diffusers pipeline directory (no {i
- Path does not exist
- Path must be a directory, not a file
- Path is not readable
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/c4880e9bc8d914c3.
Report an issue: GitHub.