unslothai/unsloth · warning · ValueError
Credential or configuration directories are not allowed
Error message
Credential or configuration directories are not allowed
What it means
Validation error from add_scan_folder_with_status: _contains_sensitive_path_component(normalized) matched a credential/configuration component (e.g. .ssh, .aws, .gnupg, or similar config dirs, via the shared sensitive-path denylist). These directories hold secrets and must never become browsable/registered scan roots.
Source
Thrown at studio/backend/hub/storage/scan_folders.py:135
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")
conn = get_connection()
try:
_ensure_schema(conn)
now = datetime.now(timezone.utc).isoformat()
if is_win:
existing = conn.execute(
"SELECT id, path, created_at FROM scan_folders WHERE path = ? COLLATE NOCASE",
(normalized,),
).fetchone()View on GitHub (pinned to 203007d190)
Solutions
- Move the model files out of the sensitive directory into a neutral one (e.g. ~/models) and register that.
- Symlink the model data into a non-sensitive path and register the symlink target's parent (realpath is applied, so the link must resolve outside sensitive dirs).
Example fix
# before
add_scan_folder('/home/alice/.config/models')
# after
mkdir -p /home/alice/models && mv /home/alice/.config/models/* /home/alice/models/
add_scan_folder('/home/alice/models') Defensive patterns
Strategy: validation
Validate before calling
from utils.paths.sensitive import contains_sensitive_path_component
def scan_folder_is_clean(path: str) -> bool:
return not contains_sensitive_path_component(
os.path.realpath(os.path.expanduser(path.strip()))
) Prevention
- Keep model data out of dot-config/credential directories (.ssh, .aws, .gnupg, ...).
- Use the shared contains_sensitive_path_component predicate client-side to pre-screen paths.
- Remember the check scans all path components, not just the last one.
When it happens
Trigger: Registering ~/.ssh, ~/.aws, ~/.gnupg, ~/.config, or any path containing such a component anywhere in the path (the check looks at components, not just the tail).
Common situations: Users whose entire home is one dotdir-managed tree and try to register ~/.config/models; misunderstanding that hidden directories are fine unless they are on the credential denylist.
Related errors
- Credential or configuration directories are not allowed
- The filesystem root cannot be registered
- Path under {prefix} is not allowed
- {_cn_fs.reason}
- Provider base URL points at a private address, which is disa
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/7a8fe6c1bc0a56a7.
Report an issue: GitHub.