You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 13, 2026. It is now read-only.
patch_vault_file fails silently when the target heading exists inside a parent section. Instead of raising an error, it appends a new heading at the wrong level, corrupting the document structure.
Root Cause
The tool constructs heading targets using only the leaf heading name (e.g., "Section B"), but the underlying obsidian-local-rest-api passes this to markdown-patch, which requires fully-qualified hierarchical paths (e.g., "Parent Section\x1fSection B" using the unit separator \x1f as delimiter).
When the leaf-only lookup fails, markdown-patch falls through to createTargetIfMissing: true behavior and appends a new heading instead of raising PatchFailed. The caller receives no error signal.
Summary
patch_vault_filefails silently when the target heading exists inside a parent section. Instead of raising an error, it appends a new heading at the wrong level, corrupting the document structure.Root Cause
The tool constructs heading targets using only the leaf heading name (e.g.,
"Section B"), but the underlyingobsidian-local-rest-apipasses this tomarkdown-patch, which requires fully-qualified hierarchical paths (e.g.,"Parent Section\x1fSection B"using the unit separator\x1fas delimiter).When the leaf-only lookup fails,
markdown-patchfalls through tocreateTargetIfMissing: truebehavior and appends a new heading instead of raisingPatchFailed. The caller receives no error signal.Related Issues
coddingtonbear/markdown-patch#7—replace+createTargetIfMissingcauses silent corruption instead of raisingPatchFailedcoddingtonbear/obsidian-local-rest-api#221— MCP tool constructs leaf-only targets with no way for callers to provide qualified pathsReproduction
markdown
patch_vault_filetargeting"Section B"with a replacement## Section Bis appended at the end instead of replacing the existing one; no error is raisedExpected Behavior
Either:
"Parent Section\x1fSection B") so callers can precisely target nested headings, orWorkaround
Use
create_vault_filefor full rewrites. Heading-targeted patches viapatch_vault_fileare unreliable for any non-top-level heading.