Skip to content

Where to look first

console.error(command.session?.diagnostics);
// e.g. "No conversation found with session ID: abc"

And inspect() when the question is what was actually going to run:

console.log(command.inspect());
// provider, full argv, the stdin payload, model, permissions, session liveness

diagnostics and inspect() answer the two halves of almost every failure.

Question What to read
Why did the CLI refuse or die? command.session?.diagnostics — stderr, in full
What was going to run at all? command.inspect() — provider, argv, stdin payload, model, permissions, session state

inspect() is useful even before anything has run, because nothing reaches the CLI until send(). A command that has been assembled but not sent still describes itself completely, ending with (not started).

const command = Command.open(Claude, { workingDir: '/proj' });
command.setModel('opus').setPermissions('plan').setMessage('Plan the migration');
console.log(command.inspect());
// provider: claude
// command: claude -p --output-format stream-json …
// stdin: {"type":"user","message":{"role":"user","content":"Plan the migration"}}
// model: opus
// permissions: plan
// attachments: 0
// workingDir: /proj
// session: 3f2a… (not started)

toString() delegates to inspect(), so a command logged or interpolated reads as its full state rather than as [object Object].

Once you know what ran and what the CLI said about it, the symptom index maps what you are seeing to its most likely cause.