Troubleshooting & Diagnostics
Resolve common exceptions, interpret secret-safe mismatch reports, and use the built-in `vexfox` command-line toolkit to validate your cassette library.
1. Core Exceptions & How to Fix Them
Raised during replay mode when an incoming request does not match any recorded interaction in the cassette.
vexfox.exceptions.RequestMismatchError: No matching recorded interaction found for request: POST https://api.example.com/v1/refunds
Mismatch diagnostics:
- Interaction #1: JSON body mismatch at key 'amount': expected 1000, got 2500
- Interaction #2: HTTP method mismatch: expected 'GET', got 'POST'
Recorded interactions in cassette (fixtures/refunds.json):
* [1] POST https://api.example.com/v1/refunds (matched method/URL, body differed)
* [2] GET https://api.example.com/v1/refunds/statusRaised when `RecordMode.REPLAY` is specified and the cassette file does not exist at the given path.
Raised when an unexpected network socket is attempted in strict replay mode, guaranteeing that no rogue calls escape to external services.
Raised if a cassette JSON file has syntax errors, is empty, or violates Schema v1.
2. The Command-Line Diagnostics Toolkit
VEXFOX ships with built-in CLI commands to inspect, audit, and validate cassettes without opening Python:
# 1. Verify system environment, Python version, and HTTPX installation
vexfox doctor
# 2. List all recorded cassettes in a directory with interaction counts
vexfox list ./fixtures
# 3. Inspect a cassette's interactions, HTTP methods, and status codes
vexfox inspect fixtures/refunds.json
# 4. Validate cassette JSON Schema v1 integrity
vexfox validate fixtures/refunds.jsonInspects your environment, verifies HTTPX compatibility, and confirms that pytest plugin hooks are loaded.
Runs JSON Schema v1 checks over your cassette fixtures to catch corrupted files before pushing to CI.