Skip to main content

Variable Interpolation

Variables not being replaced

If {{variableName}} appears literally in your request instead of being substituted:
  1. Check your environment file — Variables must be defined in a .env or hitspec.yaml file.
  2. Verify the environment is active — Use hitspec run --env production (or HITSPEC_ENV), or press ctrl+e in hitspec studio.
  3. Check for typos — Variable names are case-sensitive. {{baseUrl}} and {{baseURL}} are different.
Use hitspec run --verbose to see which variables are resolved and which are missing.

Circular variable references

If you see a circular variable reference warning, check that your variables don’t reference each other:

Captures & Dependencies

Capture value is empty

If a >>>capture block isn’t extracting the expected value:
  1. Verify the path — Use name from body.data.id and ensure the response actually contains that path.
  2. Check response content type — Body paths only work on JSON responses.
  3. Ensure the request succeeds — If the request returns an error status, the response body may not contain the expected structure.
Captures are evaluated after assertions. If an assertion fails and you’re running with --bail, later requests that depend on the capture won’t run.

Dependency order issues

Requests run top-to-bottom within a file, and @depends makes sure the request it names has run first. If request B uses a capture from request A, B must declare # @depends A: Declare the dependency with @depends and read the value as {{<request name>.<capture name>}}:

SSL / TLS Errors

Certificate verification failed

If you see x509: certificate signed by unknown authority:
Only disable SSL verification for local development or testing. Never disable it for production API tests.

Self-signed certificates

For APIs using self-signed certificates, you can either disable verification or add the CA to your system trust store.

Timeout Issues

Request timeout

If requests are timing out:
The --timeout flag (and HITSPEC_TIMEOUT) take a duration string like 30s, 1m, or 500ms. The timeout key in hitspec.yaml is an integer in milliseconds (see below).
Or set it in hitspec.yaml:
A single request can override both with # @timeout 60000 (milliseconds).

Stress test timeout

During stress testing, individual request timeouts may need to be higher. Raise --timeout for the run, or # @timeout on the slow request:

hitspec serve & studio Issues

Port already in use

If you see listen tcp :4000: bind: address already in use from hitspec serve --api-only:

The API server rejects my request

hitspec serve --api-only only answers requests whose Host is a loopback address and whose JSON bodies carry Content-Type: application/json. Bind to another address with --host and send Authorization: Bearer <token> (see --api-token).

Files not appearing in the file list

If your .http or .hitspec files don’t appear:
  1. Check the working directory — hitspec studio uses the current directory by default.
  2. Check file extensions — Only .http and .hitspec files are shown.
  3. Nested directories — Files in subdirectories are shown in a tree structure. Expand the folder.

Assertion Failures

Unexpected assertion results

Common issues with assertions:
hitspec run -v prints the expected and actual value of every failed assertion.

Schema validation failures

If expect body schema ./schemas/user.json fails:
  1. Check the schema path — Relative paths are resolved from the file’s directory.
  2. Validate your schema — Ensure it’s valid JSON Schema (draft-07).
  3. Check for required fields — The response must include all required fields.

CI/CD Issues

Exit codes

hitspec uses these exit codes:

GitHub Actions fails but works locally

  1. Environment variables — Make sure all required variables are set in your CI environment.
  2. Network access — Ensure the CI runner can reach your API endpoints.
  3. Timeouts — CI runners may be slower; increase timeouts.

Performance

Slow test execution

  1. Enable parallel execution — hitspec run --parallel tests/
  2. Reduce timeout for fast-failing — hitspec run --timeout 5s
  3. Use @if/@unless to skip irrelevant tests conditionally.

Large response bodies

For endpoints returning large responses, assertions on the full body may be slow. Use specific JSONPath queries instead:

Getting Help

If your issue isn’t listed here:
  1. Run with --verbose for detailed output.
  2. Check the GitHub Issues for known bugs.
  3. Open a new issue with your .http file content, error message, and hitspec version (hitspec --version).
Last modified on October 19, 2026