{"record":{"id":"94888eed0feab2e7","repo":"HKUDS/DeepTutor","slug":"create-note-needs-a-non-empty-path","errorCode":null,"errorMessage":"create_note needs a non-empty path.","messagePattern":"create_note needs a non-empty path\\.","errorType":"exception","errorClass":"VaultError","httpStatus":null,"severity":"error","filePath":"deeptutor/capabilities/obsidian/vault.py","lineNumber":276,"sourceCode":"        for tag in _INLINE_TAG_RE.findall(body):\n            bump(tag)\n    ranked = sorted(counts.items(), key=lambda kv: (-kv[1], kv[0]))\n    return [{\"tag\": tag, \"count\": count} for tag, count in ranked[:limit]]\n\n\n# --- write operations (additive only) ---------------------------------------\n\n\ndef create_note(\n    root: Path,\n    rel_path: str,\n    content: str,\n    frontmatter: dict[str, Any] | None = None,\n) -> str:\n    \"\"\"Create a new ``.md`` note. Refuses to overwrite an existing file.\"\"\"\n    rel_path = (rel_path or \"\").strip()\n    if not rel_path:\n        raise VaultError(\"create_note needs a non-empty path.\")\n    path = _safe_join(root, _with_md_suffix(rel_path))\n    if path.exists():\n        raise VaultError(f\"Note {_with_md_suffix(rel_path)!r} already exists; use append instead.\")\n    path.parent.mkdir(parents=True, exist_ok=True)\n    path.write_text(_compose_note(frontmatter or {}, content or \"\"), encoding=\"utf-8\")\n    return _rel(root, path)\n\n\ndef append_note(root: Path, ref: str, content: str) -> str:\n    \"\"\"Append text to the end of an existing note.\"\"\"\n    path = resolve_note(root, ref)\n    if path is None:\n        raise VaultError(f\"Note {ref!r} not found; create it first.\")\n    existing = _read_text_exact(path)\n    separator = \"\" if existing.endswith(\"\\n\") or not existing else \"\\n\"\n    path.write_text(existing + separator + (content or \"\"), encoding=\"utf-8\")\n    return _rel(root, path)\n","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/capabilities/obsidian/vault.py#L258-L294","documentation":"Error \"create_note needs a non-empty path.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/capabilities/obsidian/vault.py:276 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}