What breaks
Calling sentry_sdk.init() with a functions_to_trace entry whose qualified_name contains no dot (e.g. "my_function") raises an unhandled ValueError that prevents SDK initialization entirely.
sentry_sdk.init(
dsn="https://key@sentry.io/123",
functions_to_trace=[{"qualified_name": "my_function"}],
traces_sample_rate=1.0,
)
# ValueError: not enough values to unpack (expected 2, got 1)
Traceback
File "sentry_sdk/client.py", line 510, in _setup_instrumentation
module_name, function_name = function_qualname.rsplit(".", 1)
ValueError: not enough values to unpack (expected 2, got 1)
Root cause
In _setup_instrumentation(), the call module_name, function_name = function_qualname.rsplit(".", 1) at line 510 sits before the try/except block that starts at line 512. When qualified_name has no dot, rsplit returns a single-element list, the 2-target unpacking raises ValueError, and because it is outside the try block the exception propagates all the way out of sentry_sdk.init().
What breaks
Calling
sentry_sdk.init()with afunctions_to_traceentry whosequalified_namecontains no dot (e.g."my_function") raises an unhandledValueErrorthat prevents SDK initialization entirely.Traceback
Root cause
In
_setup_instrumentation(), the callmodule_name, function_name = function_qualname.rsplit(".", 1)at line 510 sits before thetry/exceptblock that starts at line 512. Whenqualified_namehas no dot,rsplitreturns a single-element list, the 2-target unpacking raisesValueError, and because it is outside the try block the exception propagates all the way out ofsentry_sdk.init().