Skip to content

Conversation

shellmayr
Copy link
Member

  • Adds explicit exception handling to the langgraph integration
  • Set the span.status field correctly in case of error

Copy link

codecov bot commented Sep 19, 2025

❌ 8 Tests Failed:

Tests completed Failed Passed Skipped
23750 8 23742 2302
View the top 3 failed test(s) by shortest run time
tests.integrations.langgraph.test_langgraph::test_pregel_invoke_error
Stack Traces | 0.069s run time
.../integrations/langgraph/test_langgraph.py:394: in original_invoke
    raise Exception("Graph execution failed")
E   Exception: Graph execution failed

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:399: in test_pregel_invoke_error
    wrapped_invoke(pregel, test_state)
sentry_sdk/integrations/langgraph.py:213: in new_invoke
    _capture_exception(exc)
sentry_sdk/integrations/langgraph.py:54: in _capture_exception
    span.set_status(SPANSTATUS.ERROR)
E   AttributeError: type object 'SPANSTATUS' has no attribute 'ERROR'

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:396: in test_pregel_invoke_error
    with start_transaction(), pytest.raises(Exception, match="Graph execution failed"):
E   AssertionError: Regex pattern did not match.
E    Regex: 'Graph execution failed'
E    Input: "type object 'SPANSTATUS' has no attribute 'ERROR'"
tests.integrations.langgraph.test_langgraph::test_pregel_ainvoke_error
Stack Traces | 0.07s run time
.../integrations/langgraph/test_langgraph.py:428: in original_ainvoke
    raise Exception("Async graph execution failed")
E   Exception: Async graph execution failed

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:436: in run_error_test
    await wrapped_ainvoke(pregel, test_state)
sentry_sdk/integrations/langgraph.py:267: in new_ainvoke
    _capture_exception(exc)
sentry_sdk/integrations/langgraph.py:54: in _capture_exception
    span.set_status(SPANSTATUS.ERROR)
E   AttributeError: type object 'SPANSTATUS' has no attribute 'ERROR'

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:438: in test_pregel_ainvoke_error
    asyncio.run(run_error_test())
.../hostedtoolcache/Python/3.10.18....../x64/lib/python3.10/asyncio/runners.py:44: in run
    return loop.run_until_complete(main)
.../hostedtoolcache/Python/3.10.18....../x64/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
    return future.result()
.../integrations/langgraph/test_langgraph.py:431: in run_error_test
    with start_transaction(), pytest.raises(
E   AssertionError: Regex pattern did not match.
E    Regex: 'Async graph execution failed'
E    Input: "type object 'SPANSTATUS' has no attribute 'ERROR'"
tests.integrations.langgraph.test_langgraph::test_pregel_invoke_error
Stack Traces | 0.074s run time
.../integrations/langgraph/test_langgraph.py:394: in original_invoke
    raise Exception("Graph execution failed")
E   Exception: Graph execution failed

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:399: in test_pregel_invoke_error
    wrapped_invoke(pregel, test_state)
sentry_sdk/integrations/langgraph.py:213: in new_invoke
    _capture_exception(exc)
sentry_sdk/integrations/langgraph.py:54: in _capture_exception
    span.set_status(SPANSTATUS.ERROR)
E   AttributeError: type object 'SPANSTATUS' has no attribute 'ERROR'

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:399: in test_pregel_invoke_error
    wrapped_invoke(pregel, test_state)
E   AssertionError: Regex pattern did not match.
E    Regex: 'Graph execution failed'
E    Input: "type object 'SPANSTATUS' has no attribute 'ERROR'"
tests.integrations.langgraph.test_langgraph::test_pregel_ainvoke_error
Stack Traces | 0.075s run time
.../integrations/langgraph/test_langgraph.py:428: in original_ainvoke
    raise Exception("Async graph execution failed")
E   Exception: Async graph execution failed

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:436: in run_error_test
    await wrapped_ainvoke(pregel, test_state)
sentry_sdk/integrations/langgraph.py:267: in new_ainvoke
    _capture_exception(exc)
sentry_sdk/integrations/langgraph.py:54: in _capture_exception
    span.set_status(SPANSTATUS.ERROR)
E   AttributeError: type object 'SPANSTATUS' has no attribute 'ERROR'

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:438: in test_pregel_ainvoke_error
    asyncio.run(run_error_test())
.../hostedtoolcache/Python/3.9.23....../x64/lib/python3.9/asyncio/runners.py:44: in run
    return loop.run_until_complete(main)
.../hostedtoolcache/Python/3.9.23....../x64/lib/python3.9/asyncio/base_events.py:647: in run_until_complete
    return future.result()
.../integrations/langgraph/test_langgraph.py:436: in run_error_test
    await wrapped_ainvoke(pregel, test_state)
E   AssertionError: Regex pattern did not match.
E    Regex: 'Async graph execution failed'
E    Input: "type object 'SPANSTATUS' has no attribute 'ERROR'"
tests.integrations.langgraph.test_langgraph::test_pregel_ainvoke_error
Stack Traces | 0.084s run time
.../integrations/langgraph/test_langgraph.py:428: in original_ainvoke
    raise Exception("Async graph execution failed")
E   Exception: Async graph execution failed

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:436: in run_error_test
    await wrapped_ainvoke(pregel, test_state)
sentry_sdk/integrations/langgraph.py:267: in new_ainvoke
    _capture_exception(exc)
sentry_sdk/integrations/langgraph.py:54: in _capture_exception
    span.set_status(SPANSTATUS.ERROR)
                    ^^^^^^^^^^^^^^^^
E   AttributeError: type object 'SPANSTATUS' has no attribute 'ERROR'

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:438: in test_pregel_ainvoke_error
    asyncio.run(run_error_test())
.../hostedtoolcache/Python/3.12.11........./x64/lib/python3.12/asyncio/runners.py:195: in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.12.11........./x64/lib/python3.12/asyncio/runners.py:118: in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.12.11........./x64/lib/python3.12/asyncio/base_events.py:691: in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
.../integrations/langgraph/test_langgraph.py:431: in run_error_test
    with start_transaction(), pytest.raises(
E   AssertionError: Regex pattern did not match.
E    Regex: 'Async graph execution failed'
E    Input: "type object 'SPANSTATUS' has no attribute 'ERROR'"
tests.integrations.langgraph.test_langgraph::test_pregel_ainvoke_error
Stack Traces | 0.086s run time
.../integrations/langgraph/test_langgraph.py:428: in original_ainvoke
    raise Exception("Async graph execution failed")
E   Exception: Async graph execution failed

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:436: in run_error_test
    await wrapped_ainvoke(pregel, test_state)
sentry_sdk/integrations/langgraph.py:267: in new_ainvoke
    _capture_exception(exc)
sentry_sdk/integrations/langgraph.py:54: in _capture_exception
    span.set_status(SPANSTATUS.ERROR)
                    ^^^^^^^^^^^^^^^^
E   AttributeError: type object 'SPANSTATUS' has no attribute 'ERROR'

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:438: in test_pregel_ainvoke_error
    asyncio.run(run_error_test())
.../hostedtoolcache/Python/3.13.7........./x64/lib/python3.13/asyncio/runners.py:195: in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.13.7........./x64/lib/python3.13/asyncio/runners.py:118: in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.13.7........./x64/lib/python3.13/asyncio/base_events.py:725: in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
.../integrations/langgraph/test_langgraph.py:431: in run_error_test
    with start_transaction(), pytest.raises(
E   AssertionError: Regex pattern did not match.
E    Regex: 'Async graph execution failed'
E    Input: "type object 'SPANSTATUS' has no attribute 'ERROR'"
tests.integrations.langgraph.test_langgraph::test_pregel_invoke_error
Stack Traces | 0.09s run time
.../integrations/langgraph/test_langgraph.py:394: in original_invoke
    raise Exception("Graph execution failed")
E   Exception: Graph execution failed

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:399: in test_pregel_invoke_error
    wrapped_invoke(pregel, test_state)
sentry_sdk/integrations/langgraph.py:213: in new_invoke
    _capture_exception(exc)
sentry_sdk/integrations/langgraph.py:54: in _capture_exception
    span.set_status(SPANSTATUS.ERROR)
                    ^^^^^^^^^^^^^^^^
E   AttributeError: type object 'SPANSTATUS' has no attribute 'ERROR'

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:396: in test_pregel_invoke_error
    with start_transaction(), pytest.raises(Exception, match="Graph execution failed"):
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AssertionError: Regex pattern did not match.
E    Regex: 'Graph execution failed'
E    Input: "type object 'SPANSTATUS' has no attribute 'ERROR'"
tests.integrations.langgraph.test_langgraph::test_pregel_invoke_error
Stack Traces | 0.091s run time
.../integrations/langgraph/test_langgraph.py:394: in original_invoke
    raise Exception("Graph execution failed")
E   Exception: Graph execution failed

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:399: in test_pregel_invoke_error
    wrapped_invoke(pregel, test_state)
sentry_sdk/integrations/langgraph.py:213: in new_invoke
    _capture_exception(exc)
sentry_sdk/integrations/langgraph.py:54: in _capture_exception
    span.set_status(SPANSTATUS.ERROR)
                    ^^^^^^^^^^^^^^^^
E   AttributeError: type object 'SPANSTATUS' has no attribute 'ERROR'

During handling of the above exception, another exception occurred:
.../integrations/langgraph/test_langgraph.py:396: in test_pregel_invoke_error
    with start_transaction(), pytest.raises(Exception, match="Graph execution failed"):
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E   AssertionError: Regex pattern did not match.
E    Regex: 'Graph execution failed'
E    Input: "type object 'SPANSTATUS' has no attribute 'ERROR'"

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant