Skip to main content
The CLI uses distinct exit codes for each error category. Scripts and AI agents can branch on the exit code without parsing the error message.

Exit Codes

Error Response Format

Errors are written to stderr as structured JSON:
The error_type field provides a machine-readable classification:

Common Errors and Solutions

Exit 1: Client Error

Missing required flags:
Fix: Add the required --permit-from and --permit-to flags. Invalid date range:
Fix: Ensure your --permit-from date is earlier than --permit-to. Use YYYY-MM-DD format.

Exit 2: Auth Error

Fix: Set your API key via environment variable or config file. See CLI authentication.

Exit 3: Rate Limited

The CLI automatically retries rate-limited requests with exponential backoff and jitter (up to 3 retries). If this error appears, wait a moment and try again, or contact support if it persists.
Use --no-retry to disable automatic retry if you want to handle rate limits yourself in a script.

Exit 4: Credits Exhausted

Your monthly credit allowance is used up. Check your usage with shovels usage and contact sales@shovels.ai to increase your limit.

Exit 5: Server or Network Error

Check your internet connection. If the Shovels API is down, try again later. You can adjust the timeout with --timeout 60s.

Using Exit Codes in Scripts