{"record":{"id":"fd0ea7afbcd310f7","repo":"HKUDS/DeepTutor","slug":"note-ref-r-not-found-create-it-first","errorCode":null,"errorMessage":"Note {ref!r} not found; create it first.","messagePattern":"Note (.+?) not found; create it first\\.","errorType":"exception","errorClass":"VaultError","httpStatus":null,"severity":"error","filePath":"deeptutor/capabilities/obsidian/vault.py","lineNumber":289,"sourceCode":"    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\n\ndef set_property(root: Path, ref: str, key: str, value: Any) -> str:\n    \"\"\"Set a single frontmatter property on an existing note.\"\"\"\n    key = (key or \"\").strip()\n    if not key:\n        raise VaultError(\"set_property needs a non-empty key.\")\n    path = resolve_note(root, ref)\n    if path is None:\n        raise VaultError(f\"Note {ref!r} not found; create it first.\")\n    frontmatter, body = split_frontmatter(_read_text_exact(path))\n    frontmatter[key] = value\n    path.write_text(_compose_note(frontmatter, body), encoding=\"utf-8\")\n    return _rel(root, path)","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/capabilities/obsidian/vault.py#L271-L307","documentation":"Error \"Note {ref!r} not found; create it first.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/capabilities/obsidian/vault.py:289 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"}