Skip to main content
smolbren uses non-zero exit codes to signal distinct failure conditions. Scripts and agents can branch on error type by inspecting $? directly — no need to parse error messages, which may change between releases. This pairs with the structured stderr JSON (see Output Format) for cases where you need both the code and a human-readable explanation.

Exit code reference

Shell scripting examples

Auto-indexing on a missing index (exit code 5)

A common pattern in setup scripts is to index automatically the first time a vault is used:

Distinguishing vault errors from missing notes

Exit code 2 is emitted by the argument parser when a command is malformed — for example, a missing required argument or an unrecognised flag. The error message will appear on stderr as plain text (not JSON), because the error occurs before smolbren’s own error handling runs.
For details on the stderr JSON structure (error and code fields) that accompanies non-zero exits, see Output Format.