Skip to main content

Overview

Reqbook uses six exit codes. All are stable across versions you can reliably test for them in CI scripts without worrying about changes between releases.

When each code fires

Exit code 1 Test failed The request was sent successfully and a response was received, but one or more assertions in ## Expected response did not match. Check the diff output to see which fields diverged. Exit code 2 Invalid spec Reqbook could not build a valid request from the spec. This covers malformed frontmatter, missing required sections, unresolved {{variable}} references, and --env values that have no matching heading in env.md. The error message includes the file path, line number when available, and a suggested fix. Exit code 3 Engine error An internal failure prevented Reqbook from building the HTTP request. Common causes: unsupported protocol value in frontmatter, filesystem error reading a file, or a corrupted binary. Check the --verbose output for details. Exit code 4 Network error The request was built and sent but no response was received. Covers DNS resolution failure, connection refused, and timeout expiry across all retry attempts. Exit code 5 Secret detected Reqbook found a pattern matching a secret (JWT token, hex API key, sk_ prefixed key, etc.) in a markdown/config file. The process exits immediately no request is sent, no spec is executed. Move the value to .env.local or a RQB_* environment variable.

CI usage examples

Fail CI on any invalid spec
Inspect the exit code of a single endpoint test
Distinguish a network failure from a response mismatch
Full case statement

GitHub Actions example

Use RQB_* environment variables to pass secrets into CI. They map automatically to camel-case variable names RQB_AUTH_TOKEN becomes {{authToken}} in your specs.