Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Exit Codes

Crosswind uses semantic exit codes so scripts and agents can handle errors without parsing output.

Exit code table

CodeCategoryDescription
0SuccessFlights found and returned
1General errorUnexpected HTTP status, internal error
2ValidationBad airport code, invalid date, bad passenger count
3NetworkTimeout, connection failed, DNS error, TLS error
4Rate limit / blockedGoogle rate limit (429), bot detection (403/503)
5Parse errorPage structure changed, no results found

Reason codes

In JSON error envelopes, the code field provides a machine-readable reason:

Reason codeExit codeDescription
invalid_airport_code2Not a 3-letter IATA code
invalid_date2Cannot parse date input
invalid_passengers2Passenger count out of range
timeout3Request timed out
connection_failed3Could not connect
dns_resolution3DNS lookup failed
tls_error3TLS handshake failed
proxy_error3Proxy connection failed
rate_limited4HTTP 429 from Google
blocked4HTTP 403/503, bot detection
script_tag_not_found5Expected data not in page
parse_error5Failed to extract flight data
no_results5No flights for this search
http_status1Unexpected HTTP status
other1Catch-all

Usage in scripts

crosswind BEG JFK apr1 --json > flights.json
code=$?
 
case $code in
  0) echo "Success" ;;
  2) echo "Bad input, check arguments" ;;
  3) echo "Network issue, retry later" ;;
  4) echo "Rate limited, wait and retry" ;;
  5) echo "Parse error, Google may have changed" ;;
  *) echo "Unknown error" ;;
esac

Hints

Some errors include hints in both TTY and JSON modes:

error: airport code must be exactly 3 letters, got 'XX'
hint: use a 3-letter IATA code like JFK, LAX, BEG

In JSON mode, hints appear as an optional hint field in the error envelope.