This guide covers common issues encountered while using the Blocklog SDK.
Symptom: API calls return HTTP 401 Unauthorized or 403 Forbidden.
Resolution: Ensure that BLOCKLOG_API_KEY is set in your environment variables, or passed directly to blocklog.init(api_key="..."). Check that your API key is active in the Blocklog Dashboard.
Symptom: httpx.ConnectError or timeouts.
Resolution:
- If you are running Blocklog self-hosted, ensure
BLOCKLOG_BASE_URLis pointing to the correct ingest server. - The default timeout is 10 seconds. You can increase this by passing
timeout=30.0toblocklog.init(). - The SDK utilizes a
RetryPolicywith exponential backoff (default 3 retries). Ensure you have reliable internet connectivity.
Symptom: ModuleNotFoundError: No module named 'blocklog'
Resolution: Make sure the SDK is installed in your active virtual environment:
pip install blocklogVerify the installation by running python -c "import blocklog; print(blocklog.__version__)".
Symptom: Decisions or tool calls are not inheriting the agent's trace_id or session_id.
Resolution: Blocklog relies on Python contextvars to maintain session state across execution boundaries. If you manually spin off background tasks or use threading, the context might be lost. Ensure you utilize native async/await which natively supports contextvars.
If events are silently dropping, enable debug mode to see exactly what the transport layer is doing:
blocklog.init(debug=True)This will print all serialization and transport errors to stderr.