Steps to reproduce
With a vault open, run from a shell:
obsidian vault=MyVault create “path=unfiled/big.md” “content=$(head -c 8000 /dev/zero | tr ‘\0’ x)”
The same command with 4000 bytes succeeds. Content is pure ASCII, so this
is not the multibyte argument-parser bug fixed in 1.12.2.
Did you follow the troubleshooting guide? [Y/N]
Yes. Not plugin-related; the crash is in the main process handling CLI IPC, before any vault code runs.
Expected result
The note is created and the CLI prints Created: unfiled/big.md.
Actual result
The note is not created. The CLI hangs indefinitely with no output. Obsidian’s
main process raises an uncaught exception and shows a modal error dialog, after
which every subsequent CLI invocation reports “The CLI is unable to find Obsidian.”
A JavaScript error occurred in the main process
Uncaught Exception:
SyntaxError: Unexpected token ‘]’, …“-8000.md”,“tty”:fa"… is not valid JSON
at JSON.parse ()
at Socket.n (…\obsidian-1.13.6.asar\main.js:64:136)
at Socket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
Environment
Additional information
Likely cause
The socket data handler appears to call JSON.parse on each chunk as it
arrives, with no reassembly. A stream carries no message boundaries, so a
payload spanning a chunk boundary is parsed as a truncated fragment. The
quoted text is cut mid-value at "tty":fa, which is what a raw chunk split
looks like rather than malformed input. The onset near 4 KB is consistent
with a default pipe buffer.
Three separable issues:
- No message reassembly before
JSON.parse. - The parse error is uncaught in the main process, so a bad read escalates
to a modal dialog that wedges the app instead of returning an error. - The CLI has no timeout, so it waits forever for a reply that cannot arrive.
Issue 2 is the most damaging in practice: a client gets no error, the write
is silently lost, and the app needs manual intervention before any further
CLI call works.