Registry / observability / bugsnag

bugsnag

JSON →
library4.9.1pypypi✓ verified 25d ago

Bugsnag is a comprehensive error monitoring library for Python applications, including frameworks like Django, Flask, and Tornado. It automatically detects and reports unhandled exceptions, and allows for manual reporting of handled errors, providing detailed diagnostic information to a central dashboard. The library is actively maintained, currently at version 4.8.1, with regular updates to support new Python features and integrations.

pip install bugsnag
INSTALL
IMPORT
SIG · BUGSNAG
B
bugsnag
observabilitypythonv4.9.1
Install
1.7s avg
Import
164ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.9.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.176s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.152s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

bugsnag
import bugsnag
Main module for configuration and error notification.
BugsnagHandler
from bugsnag.handlers import BugsnagHandler
Used to integrate Bugsnag with Python's standard logging framework.

This quickstart demonstrates basic Bugsnag configuration and how to manually report a handled exception. Ensure `BUGSNAG_API_KEY` is set in your environment or replace the placeholder.

import bugsnag import os bugsnag.configure( api_key=os.environ.get('BUGSNAG_API_KEY', 'YOUR_API_KEY_HERE'), release_stage='development', project_root=os.path.dirname(os.path.abspath(__file__)), ) def might_fail(): raise ValueError("This is a test error!") try: might_fail() except Exception as e: print(f"Caught an error: {e}. Notifying Bugsnag...") bugsnag.notify(e) print("Notification sent.") # To demonstrate unhandled error reporting, you would typically not catch it. # For example, simply calling might_fail() outside a try-except block in a WSGI/ASGI app.
Debug
Known issues
breakingMigrating from Bugsnag Python 3.x to 4.x requires Python 3.5+. Older Python versions are no longer supported. The `bugsnag.utils.ThreadLocals` utility has been removed.
fix
Upgrade Python to 3.5 or newer. Remove usage of `bugsnag.utils.ThreadLocals`. Review and update any uses of deprecated properties from 2.x which were removed in 4.x.
affects: >=4.0.0
breakingThe `Configuration.send_environment` option is now `False` by default in v4.x, meaning request context (like environment variables) will not be sent unless explicitly enabled. Setting unknown properties via `bugsnag.configure(**kwargs)` is no longer supported and will cause an error.
fix
To send environment data, set `send_environment=True` in your configuration. Ensure all configuration properties passed to `configure()` are recognized by the library.
affects: >=4.0.0
breakingIn Bugsnag 4.x, `use_ssl` and `Configuration.get_endpoint()` have been deprecated in favor of including the protocol (e.g., `https://`) directly in the `endpoint` configuration option.
fix
Replace `config.use_ssl = True` and `config.endpoint = 'my.example.com'` with `config.endpoint = 'https://my.example.com'`.
affects: >=4.0.0
gotchaAutomatic detection of unhandled exceptions in threads relies on `threading.excepthook`, which is only supported in Python 3.8 and above. For older Python 3 versions, unhandled exceptions in non-main threads might not be automatically reported.
fix
For full coverage, ensure your application runs on Python 3.8+. Alternatively, manually wrap critical thread logic with `try...except` and `bugsnag.notify()` for older Python versions.
affects: <3.8
gotchaIt is crucial to use `params_filters` to prevent sensitive data (e.g., passwords, credit card numbers) from being sent to Bugsnag in your error reports.
fix
Configure `params_filters` in `bugsnag.configure()` with a list of strings whose matching keys should be filtered from payloads. Example: `bugsnag.configure(params_filters=['password', 'credit_card_number'])`.
affects: All
gotchaThe introduction of `__all__` lists in Bugsnag 4.x may affect existing integrations that use `from bugsnag import *` by changing which symbols are exposed during a wildcard import.
fix
Avoid using `from bugsnag import *`. Instead, explicitly import only the necessary symbols (e.g., `import bugsnag` or `from bugsnag import notify`).
affects: >=4.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'bugsnag'
The 'bugsnag' package has not been installed in the current Python environment or the environment where the application is running.
fix
Ensure the bugsnag library is installed using pip: `pip install bugsnag`
[Bugsnag] Invalid API key 'undefined'
The Bugsnag API key has not been provided or is incorrectly configured in your application's settings, often appearing as 'undefined' or an empty string.
fix
Set the `api_key` configuration option with your actual Bugsnag API key, either directly in code (e.g., `bugsnag.configure(api_key='YOUR_API_KEY')`) or via the `BUGSNAG_API_KEY` environment variable.
ImportError: cannot import name 'BugsnagHandler' from 'bugsnag.handlers'
This error typically occurs if there's a typo in the import statement, the `bugsnag.handlers` module is not accessible, or a version mismatch exists where the specific handler might have moved or been renamed.
fix
Verify the import statement for `BugsnagHandler` is `from bugsnag.handlers import BugsnagHandler` and ensure your `bugsnag` package is up-to-date. If using an older version, consult the documentation for the correct import path.
Bugsnag not sending errors in development
Errors are not being reported because the application's `release_stage` is set to 'development' (or another non-notifying stage) and 'development' is not included in the `notify_release_stages` configuration.
fix
Configure `notify_release_stages` to include the current `release_stage`, e.g., `bugsnag.configure(release_stage='development', notify_release_stages=['development', 'production'])`.
Upgrade
Version history
4.9.1latest on PyPI · released Jun 18, 2026
Audit
Dependencies
pythonrequiredRequires Python versions >=3.5 and <4 for bugsnag v4.x. Earlier Python versions are not supported.
requestsoptionalUsed by default for asynchronous error report delivery if installed. If not present, bugsnag falls back to urllib delivery.
opentelemetry-distrooptionalRequired for performance monitoring and distributed tracing, which Bugsnag leverages via OpenTelemetry.
opentelemetry-exporter-otlpoptionalRequired for sending OpenTelemetry spans and traces to Bugsnag.
Agent activity
29 hits · last 30 days
node
22
OpenAI (training)
1
Resources
bugsnag — pip install bugsnag · libregistry