HKUDS/DeepTutor · error · ValueError
Not a directory: {folder}
Error message
Not a directory: {folder} What it means
Raised by assert_path_allowed when the given folder exists but is not a directory (e.g. it is a regular file, socket, or broken special node). This is the second guard after existence, before symlink resolution and allowlist checks.
Source
Thrown at deeptutor/services/rag/linked_kb.py:104
roots.append(Path(chunk).expanduser().resolve())
except OSError:
continue
return roots
def assert_path_allowed(folder_path: str) -> Path:
"""Resolve ``folder_path`` and enforce the optional root allowlist.
Returns the resolved absolute path. Raises ``ValueError`` if the folder is
missing/not a directory, or escapes the configured allowlist (symlinks are
resolved first so they can't tunnel out). With no allowlist set, any
existing directory is permitted — the self-hosted default.
"""
folder = Path(folder_path).expanduser()
if not folder.exists():
raise ValueError(f"Folder does not exist: {folder}")
if not folder.is_dir():
raise ValueError(f"Not a directory: {folder}")
resolved = folder.resolve()
roots = allowed_link_roots()
if roots and not any(_is_within(resolved, root) for root in roots):
raise ValueError("This folder is outside the locations allowed for linking.")
return resolved
def _is_within(path: Path, root: Path) -> bool:
try:
return path == root or root in path.parents
except OSError:
return False
def probe_linked_folder(folder_path: str, provider: str) -> ProbeResult:
"""Inspect ``folder_path`` for a ready ``provider`` index.
View on GitHub (pinned to 3e82f13042)
Solutions
- Check with Path(p).is_dir() and pass the containing directory instead.
- If linking a single file is intended, use the document upload API rather than linked folders.
- Fix the source of the path in your script/UI so it selects directories only.
Example fix
# before folder = "/home/user/notes/index.md" # after folder = "/home/user/notes"
Defensive patterns
Strategy: validation
Validate before calling
if not Path(folder_path).expanduser().is_dir():
raise InputError("linked folder must be a directory") Prevention
- Validate is_dir() client-side; reject file paths in the selection UI.
When it happens
Trigger: Passing a file path (e.g. a .zip or .md file) where a folder is expected to connect_obsidian_vault / connect_linked_folder_route / create_connection; pointing at a FIFO or device node.
Common situations: Users pasting a file path from their file manager instead of its parent folder; automated scripts deriving the path from a file variable.
Related errors
- Folder does not exist: {folder}
- This folder is outside the locations allowed for linking.
- PageIndex API key is not configured. Add it under Knowledge
- PageIndex OSS preflight failed: {details}
- GraphRAG is not installed. Run `pip install 'deeptutor[graph
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/44ea936987e80c7f.
Report an issue: GitHub.