HKUDS/DeepTutor · error · VaultError
Path {rel!r} escapes the vault.
Error message
Path {rel!r} escapes the vault. What it means
Error "Path {rel!r} escapes the vault." thrown in HKUDS/DeepTutor.
Source
Thrown at deeptutor/capabilities/obsidian/vault.py:93
than letting ``UnicodeDecodeError`` escape) is what makes the refusal
legible: the tool layer turns it into a message naming the note and the
fix, instead of an opaque failure.
"""
try:
return path.read_text(encoding="utf-8")
except UnicodeDecodeError as exc:
raise VaultError(
f"Note {path.name!r} is not valid UTF-8 (byte offset {exc.start}); "
"editing it would corrupt the undecodable bytes. Fix its encoding first."
) from exc
def _safe_join(root: Path, rel: str) -> Path:
"""Resolve ``rel`` under ``root``, refusing anything that escapes the vault."""
root_resolved = root.resolve()
candidate = (root_resolved / rel.lstrip("/")).resolve()
if candidate != root_resolved and root_resolved not in candidate.parents:
raise VaultError(f"Path {rel!r} escapes the vault.")
return candidate
def _with_md_suffix(rel: str) -> str:
return rel if rel.lower().endswith(".md") else f"{rel}.md"
def resolve_note(root: Path, ref: str) -> Path | None:
"""Resolve a note reference to a file path the way Obsidian links do.
``ref`` may be a vault-relative path (``folder/Note.md``) or a bare note
name (``Note``) matched by basename anywhere in the vault. Returns ``None``
when nothing matches.
"""
ref = (ref or "").strip().split("#", 1)[0].split("|", 1)[0].strip()
if not ref:
return None
# Explicit path (has a separator or .md suffix) → resolve directly.View on GitHub (pinned to 3e82f13042)
When it happens
Trigger: Thrown at deeptutor/capabilities/obsidian/vault.py:93 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/284309edc85e9685.
Report an issue: GitHub.