HKUDS/DeepTutor · error · VaultError

set_property needs a non-empty key.

Error message

set_property needs a non-empty key.

What it means

Input guard in set_property: the frontmatter key is empty after trimming, so there is no property name to set. Frontmatter keys must be non-empty strings.

Solutions

  1. Pass a concrete key such as 'tags' or 'status'
  2. Reject blank keys client-side before the call
  3. For tag edits, use the dedicated tag operations instead of ad-hoc properties
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at deeptutor/capabilities/obsidian/vault.py:300 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/237e7dfbfe79aae0. Report an issue: GitHub.

Appendix: source

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

    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)


def set_property(root: Path, ref: str, key: str, value: Any) -> str:
    """Set a single frontmatter property on an existing note."""
    key = (key or "").strip()
    if not key:
        raise VaultError("set_property needs a non-empty key.")
    path = resolve_note(root, ref)
    if path is None:
        raise VaultError(f"Note {ref!r} not found; create it first.")
    frontmatter, body = split_frontmatter(_read_text_exact(path))
    frontmatter[key] = value
    path.write_text(_compose_note(frontmatter, body), encoding="utf-8")
    return _rel(root, path)


__all__ = [
    "VaultError",
    "IGNORED_DIRS",
    "resolve_note",
    "read_note",
    "search_notes",
    "list_notes",
    "outgoing_links",
    "backlinks",

View on GitHub (pinned to 3e82f13042)