Sentry Python SDK 3.0: Unknown option ‘send_default_pii’
Sentry’s Python SDK 3.0 removed send_default_pii. An existing configuration can therefore fail at
sentry_sdk.init() with:
TypeError: Unknown option 'send_default_pii'TypeError: Unknown option 'send_default_pii'
Remove the argument from init(). Whether you need a replacement depends on its old value: SDK 3.0 collects
more data by default.
Previously True
If you had send_default_pii=True, remove it. The new defaults already collect user information and HTTP bodies.
For example, an application sending errors to Bugsink can use:
import os import sentry_sdk sentry_sdk.init( dsn=os.environ["SENTRY_DSN"], traces_sample_rate=0, send_client_reports=False, auto_session_tracking=False, )import os import sentry_sdk sentry_sdk.init( dsn=os.environ["SENTRY_DSN"], traces_sample_rate=0, send_client_reports=False, auto_session_tracking=False, )
Bugsink’s earlier Python setup example included the removed argument. Keep your existing DSN; this error occurs in the SDK, before it sends anything to the server.
Previously False or unset
Deleting send_default_pii=False changes what you send. Use data_collection to choose the categories you want
to keep. For example, to disable user information and HTTP bodies, add this argument to init():
data_collection={ "user_info": False, "http_bodies": [], },data_collection={ "user_info": False, "http_bodies": [], },
That addresses those two categories only. Headers, cookies, query parameters, and other integration data have separate rules; there is no single replacement boolean for the old setting.
Local variables
The SDK also stopped scrubbing sensitive local-variable names by default. To retain debugging context while applying
the built-in denylist, add this entry to the same data_collection dictionary:
"stack_frame_variables": {"mode": "denylist"},"stack_frame_variables": {"mode": "denylist"},
To disable local variables altogether, use "stack_frame_variables": False instead. This replaces the removed
include_local_variables option. The removed include_source_context=False option becomes frame_context_lines=0
inside data_collection.
The startup error was reproduced with SDK 3.0.0 and 3.0.1, and error delivery checked against Bugsink 2.7.1. For the logging and other configuration changes, see the migration reference.
