HKUDS/DeepTutor · error · VaultError

create_note needs a non-empty path.

Error message

create_note needs a non-empty path.

What it means

Error "create_note needs a non-empty path." thrown in HKUDS/DeepTutor.

Source

Thrown at deeptutor/capabilities/obsidian/vault.py:276

        for tag in _INLINE_TAG_RE.findall(body):
            bump(tag)
    ranked = sorted(counts.items(), key=lambda kv: (-kv[1], kv[0]))
    return [{"tag": tag, "count": count} for tag, count in ranked[:limit]]


# --- write operations (additive only) ---------------------------------------


def create_note(
    root: Path,
    rel_path: str,
    content: str,
    frontmatter: dict[str, Any] | None = None,
) -> str:
    """Create a new ``.md`` note. Refuses to overwrite an existing file."""
    rel_path = (rel_path or "").strip()
    if not rel_path:
        raise VaultError("create_note needs a non-empty path.")
    path = _safe_join(root, _with_md_suffix(rel_path))
    if path.exists():
        raise VaultError(f"Note {_with_md_suffix(rel_path)!r} already exists; use append instead.")
    path.parent.mkdir(parents=True, exist_ok=True)
    path.write_text(_compose_note(frontmatter or {}, content or ""), encoding="utf-8")
    return _rel(root, path)


def append_note(root: Path, ref: str, content: str) -> str:
    """Append text to the end of an existing note."""
    path = resolve_note(root, ref)
    if path is None:
        raise VaultError(f"Note {ref!r} not found; create it first.")
    existing = _read_text_exact(path)
    separator = "" if existing.endswith("\n") or not existing else "\n"
    path.write_text(existing + separator + (content or ""), encoding="utf-8")
    return _rel(root, path)

View on GitHub (pinned to 3e82f13042)

When it happens

Trigger: Thrown at deeptutor/capabilities/obsidian/vault.py:276 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/94888eed0feab2e7. Report an issue: GitHub.