You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: gRPC interceptor swallows exceptions and returns None instead of re-raising #895
The create_span wrapper in instana/instrumentation/grpcio.py catches exceptions
from gRPC stubs, records them on the trace span, and then falls off the end of
the function returning None. gRPC then tries to unpack the return value as a tuple:
The real gRPC status code (e.g. PERMISSION_DENIED) is silently absorbed into the
span and never reaches the caller. This makes the error completely undiagnosable
from the application side.
This only happens inside an active Instana span (i.e. inside a traced API request).
Calling the same gRPC method without Instana active gives the correct RpcError.
# Reproduce: make a gRPC call via pymilvus inside a traced FastAPI request# (Instana must be active with a live span)frompymilvusimportutilityutility.has_collection("my_collection", using="my_connection")
# Expected: grpc.RpcError with StatusCode.PERMISSION_DENIED# Actual: TypeError: cannot unpack non-iterable NoneType object# Root cause in instana/instrumentation/grpcio.py::create_span:# The wrapper catches the gRPC exception, records it on the span via# span.record_exception(exc), but never re-raises — the function returns# None implicitly.# gRPC then does: response, call = None -> TypeError## Fix: add `raise` after span.record_exception(exc) in create_span
Running inside a CP4D (Cloud Pak for Data) Kubernetes pod.
Instana is loaded via AUTOWRAPT_BOOTSTRAP=instana environment variable.
Python 3.11 / 3.12 (container image).
Key env vars relevant to this bug:
AUTOWRAPT_BOOTSTRAP=instana
INSTANA_SERVICE_NAME=datasift-api
Hello @Harshad01 , thanks for the clear report and minimal reproduction.
Your analysis is correct. create_span was catching gRPC exceptions and recording them on the span, but never re-raising them. This caused the wrapper to return None, leading to the tuple unpacking TypeError inside gRPC's interceptor layer and masking the underlying grpc.RpcError.
Activity
CagriYonca commentedon Oct 6, 2026
Hello @Harshad01 , thanks for the clear report and minimal reproduction.
Your analysis is correct.
create_spanwas catching gRPC exceptions and recording them on the span, but never re-raising them. This caused the wrapper to returnNone, leading to the tuple unpackingTypeErrorinside gRPC's interceptor layer and masking the underlyinggrpc.RpcError.We've addressed this in PR #911 by:
with_calland gRPC interceptors.Could you please review the changes and, if possible, pull from the branch and try with your application?