Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exit Codes

Bobbin uses standard Unix exit codes. All commands follow the same convention.

Exit Code Table

CodeMeaningCommon Causes
0SuccessCommand completed normally
1General errorInvalid arguments, missing configuration, runtime errors
2Usage errorInvalid command syntax (from clap argument parser)

Common Error Scenarios

Not Initialized (exit 1)

Error: Bobbin not initialized in /path/to/project. Run `bobbin init` first.

Occurs when running any command that requires an index (search, grep, context, status, serve, etc.) before running bobbin init.

No Indexed Content (exit 0, empty results)

Commands like search and grep return exit code 0 with zero results if the index exists but is empty. Run bobbin index to populate it.

Invalid Arguments (exit 2)

error: unexpected argument '--foo' found

The clap argument parser returns exit code 2 for unrecognized flags, missing required arguments, or invalid argument values.

File Not Found (exit 1)

Error: File not found in index: src/nonexistent.rs

Occurs when related or read_chunk references a file that isn’t in the index.

Invalid Search Mode (exit 1)

Error: Invalid search mode: 'fuzzy'. Use 'hybrid', 'semantic', or 'keyword'

Using Exit Codes in Scripts

# Check if bobbin is initialized
if bobbin status --quiet 2>/dev/null; then
    echo "Index ready"
else
    bobbin init && bobbin index
fi

# Search with error handling
if ! bobbin search "auth" --json > results.json; then
    echo "Search failed" >&2
    exit 1
fi

JSON Error Output

When using --json mode, errors are still printed to stderr as plain text. Only successful results are written to stdout as JSON.