Description
patch_vault_file returns an error when the target heading contains non-ASCII characters (Cyrillic, Chinese, Japanese, Arabic, etc.).
Error
MCP error -32603: Header 'Target' has invalid value: 'Детали'
Steps to reproduce
- Create a note with a Cyrillic (or any non-ASCII) heading, e.g.
## Детали
- Call
patch_vault_file with target: "Детали", targetType: "heading"
- The tool returns the error above immediately — the request never reaches the REST API
Root cause
The mcp-server binary sets the heading name directly as an HTTP header value:
Go's net/http package rejects non-ASCII bytes in header values at the client side, so the request is never sent.
Notably, obsidian-local-rest-api already calls decodeURIComponent() on the Target header value on the server side — so it is ready to accept a percent-encoded value.
Fix
One line in the Go HTTP client, before setting the header:
req.Header.Set("Target", url.QueryEscape(target))
This makes encoding consistent with what the server already expects.
Impact
Any vault with non-English headings cannot use patch_vault_file at all. The only current workaround is to rename all headings intended for AI editing to ASCII — which is impractical for non-English users.
Environment
- MCP Tools: v0.2.27
- obsidian-local-rest-api: v3.6.1
- Obsidian: v1.12.7
- OS: macOS (arm64)
Description
patch_vault_filereturns an error when thetargetheading contains non-ASCII characters (Cyrillic, Chinese, Japanese, Arabic, etc.).Error
Steps to reproduce
## Деталиpatch_vault_filewithtarget: "Детали",targetType: "heading"Root cause
The
mcp-serverbinary sets the heading name directly as an HTTP header value:Go's
net/httppackage rejects non-ASCII bytes in header values at the client side, so the request is never sent.Notably,
obsidian-local-rest-apialready callsdecodeURIComponent()on theTargetheader value on the server side — so it is ready to accept a percent-encoded value.Fix
One line in the Go HTTP client, before setting the header:
This makes encoding consistent with what the server already expects.
Impact
Any vault with non-English headings cannot use
patch_vault_fileat all. The only current workaround is to rename all headings intended for AI editing to ASCII — which is impractical for non-English users.Environment