Skip to content

academic-research agent giving "ERROR - init.py:157 - Failed to detach context" #305

@harind-no

Description

@harind-no

academic-research agent is not working after summarizing the pdf. Giving this error:

2025-08-10 15:42:31,678 - WARNING - types.py:5259 - Warning: there are non-text parts in the response: ['thought_signature'], returning concatenated text result from text parts. Check the full candidates.content.parts accessor to get the full model response.
INFO: 49.43.202.223:0 - "GET /apps/academic_research/users/user/sessions/59a74048-450f-4279-8125-8e4c9a5782c7 HTTP/1.1" 200 OK
INFO: 49.43.202.223:0 - "GET /debug/trace/session/59a74048-450f-4279-8125-8e4c9a5782c7 HTTP/1.1" 200 OK
INFO: 49.43.202.223:0 - "POST /run_sse HTTP/1.1" 200 OK
2025-08-10 15:42:39,471 - INFO - envs.py:47 - Loaded .env file for academic_research at /workspaces/adk-samples/python/agents/academic-research/academic_research/.env
2025-08-10 15:42:39,517 - INFO - google_llm.py:111 - Sending out request, model: gemini-2.5-flash, backend: GoogleLLMVariant.VERTEX_AI, stream: False
2025-08-10 15:42:39,517 - INFO - models.py:7804 - AFC is enabled with max remote calls: 10.
2025-08-10 15:42:54,119 - INFO - _client.py:1740 - HTTP Request: POST https://us-central1-aiplatform.googleapis.com/v1beta1/projects/no-research/locations/us-central1/publishers/google/models/gemini-2.5-flash:generateContent "HTTP/1.1 200 OK"
2025-08-10 15:42:54,121 - INFO - google_llm.py:203 - Response received from the model.
2025-08-10 15:42:54,121 - WARNING - types.py:5259 - Warning: there are non-text parts in the response: ['thought_signature', 'function_call'], returning concatenated text result from text parts. Check the full candidates.content.parts accessor to get the full model response.
2025-08-10 15:42:54,171 - INFO - google_llm.py:111 - Sending out request, model: gemini-2.5-flash, backend: GoogleLLMVariant.VERTEX_AI, stream: False
2025-08-10 15:42:54,171 - INFO - models.py:7804 - AFC is enabled with max remote calls: 10.
build graph
INFO: 49.43.202.223:0 - "GET /apps/academic_research/users/user/sessions/59a74048-450f-4279-8125-8e4c9a5782c7/events/32895ace-4dc3-4dc0-9c28-bff9abae079c/graph HTTP/1.1" 200 OK
INFO: 49.43.202.223:0 - "GET /debug/trace/32895ace-4dc3-4dc0-9c28-bff9abae079c HTTP/1.1" 404 Not Found
build graph
INFO: 49.43.202.223:0 - "GET /apps/academic_research/users/user/sessions/59a74048-450f-4279-8125-8e4c9a5782c7/events/5c9900bf-f07a-4aa8-9a48-fbc6522db0b0/graph HTTP/1.1" 200 OK
INFO: 49.43.202.223:0 - "GET /debug/trace/5c9900bf-f07a-4aa8-9a48-fbc6522db0b0 HTTP/1.1" 200 OK
2025-08-10 15:43:39,467 - ERROR - init.py:157 - Failed to detach context
Traceback (most recent call last):
File "/home/codespace/.cache/pypoetry/virtualenvs/academic-research-cgAc3NVp-py3.12/lib/python3.12/site-packages/opentelemetry/trace/init.py", line 589, in use_span
yield span
File "/home/codespace/.cache/pypoetry/virtualenvs/academic-research-cgAc3NVp-py3.12/lib/python3.12/site-packages/opentelemetry/sdk/trace/init.py", line 1105, in start_as_current_span
yield span
File "/home/codespace/.cache/pypoetry/virtualenvs/academic-research-cgAc3NVp-py3.12/lib/python3.12/site-packages/opentelemetry/trace/init.py", line 454, in start_as_current_span
yield span
File "/home/codespace/.cache/pypoetry/virtualenvs/academic-research-cgAc3NVp-py3.12/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 629, in _call_llm_async
yield llm_response
GeneratorExit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/codespace/.cache/pypoetry/virtualenvs/academic-research-cgAc3NVp-py3.12/lib/python3.12/site-packages/opentelemetry/context/init.py", line 155, in detach
_RUNTIME_CONTEXT.detach(token)
File "/home/codespace/.cache/pypoetry/virtualenvs/academic-research-cgAc3NVp-py3.12/lib/python3.12/site-packages/opentelemetry/context/contextvars_context.py", line 53, in detach
self._current_context.reset(token)
ValueError: <Token var=<ContextVar name='current_context' default={} at 0x761e17a37ab0> at 0x761e0fed69c0> was created in a different Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions