Repository navigation
INVALID_ARGUMENT in VertexAiSessionService during A2A call due to UUID session ID #2727
Description
Describe the bug
A 400 INVALID_ARGUMENT error with the message "Invalid Session resource name" occurs when an agent using VertexAiSessionService is called from another agent via A2A (Agent-to-Agent) communication.
This issue does not occur when interacting with the agent without using A2A.
To Reproduce
Steps to reproduce the behavior:
- Create an agent that utilizes
VertexAiSessionService. - From a different agent, attempt to connect to the first agent using A2A.
- Initiate a conversation.
- See the following error:
400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'List of found errors:\t1.Field: name; Message: Invalid Session resource name.\t', 'status': 'INVALID_ARGUMENT', 'details': [{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'name', 'description': 'Invalid Session resource name.'}]}]}}}
Expected behavior
The A2A connection should be established successfully without any errors, and a new session should be created in the VertexAiSessionService-backed agent.
Screenshots
N/A
Desktop (please complete the following information):
- OS: Debian 13 (Using
pythondocker image) - Python version(python -V): 3.13.7
- ADK version(pip show google-adk): 1.12.0
Model Information:
gemini-2.5-pro
Additional context
The root cause appears to be a mismatch in session ID formats.
Based on the source code, the A2A SendMessageRequest in remote_a2a_agent.py uses a UUID as the session ID.
adk-python/src/google/adk/agents/remote_a2a_agent.py
Lines 472 to 473 in 5b999ed
| a2a_request = SendMessageRequest( | |
| id=str(uuid.uuid4()), |
adk-python/src/google/adk/agents/remote_a2a_agent.py
Lines 319 to 320 in 5b999ed
| return SendMessageRequest( | |
| id=str(uuid.uuid4()), |
However, when the receiving agent's VertexAiSessionService tries to create the session, it passes this UUID directly to the Vertex AI API.
adk-python/src/google/adk/sessions/vertex_ai_session_service.py
Lines 77 to 81 in 5b999ed
| get_session_api_response = await api_client.async_request( | |
| http_method='GET', | |
| path=f'reasoningEngines/{reasoning_engine_id}/sessions/{session_id}', | |
| request_dict={}, | |
| ) |
The Vertex AI API seems to expect a numeric ID for the session resource name, not a UUID. This causes the "Invalid Session resource name" error.
This can be verified by sending a request with a UUID-formatted session ID directly to the Vertex AI API, which reproduces the error:
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://<location>-aiplatform.googleapis.com/v1beta1/projects/<our-project>/locations/<location>/reasoningEngines/<engine-id>/sessions/7e56773c-8968-4fe5-97c0-cc8d14e200e1"
{
"error": {
"code": 400,
"message": "List of found errors:\t1.Field: name; Message: Invalid Session resource name.\t",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "name",
"description": "Invalid Session resource name."
}
]
}
]
}
}
Activity
surajksharma07 commentedon Dec 3, 2025
@ftnext This issue was fixed in ADK v1.19.0 (October 2025, commit 2158b3c).
The root cause was UUID-format session IDs from A2A message_id being passed to VertexAI API, which expects specific session resource name format.
The fix ensures proper context_id → session_id mapping in request_converter.py (line 122).
Users experiencing this error should upgrade to ADK v1.19.0 or later:
pip install --upgrade google-adk>=1.19.0Thanks!
nikunjshantiairasia commentedon Dec 17, 2025
I am still seeing this issue in 1.21 when using agent starter pack with a2a base
surajksharma07 commentedon Dec 17, 2025
@nikunjshantiairasia The context_id extraction fix (commit 2158b3c) is included in v1.21.0.
However, there are edge cases where UUID session IDs can still be generated - specifically when there's no existing context_id in metadata (first A2A call in a new conversation).
Can you share the full error traceback and your agent configuration?
Also confirm if this happens on the first A2A message or on subsequent messages in the conversation.
If it's the initial message, the issue might be that context_id is None and falls back to message_id (UUID), which VertexAI rejects.
A quick workaround is to pre-populate context_id in the A2A request metadata with a VertexAI-compatible session ID format before the first call, or use InMemorySessionService instead of VertexAiSessionService for A2A agents.
ftnext commentedon Dec 18, 2025
@surajksharma07 Thank you for working on this issue.
This issue is still reproducible in ADK 1.21.0.
Please re-open this issue.
I'll demonstrate with a sample.
https://github.com/google/adk-python/tree/v1.21.0/contributing/samples/a2a_basic
When asking "Is 7 a prime number?", the prime agent is called via A2A.
adk api_serverlogsurajksharma07 commentedon Dec 18, 2025
@ftnext Thanks for the detailed reproduction with the a2a_basic sample.
You're correct - the issue still exists in v1.21.0.
The original fix in v1.19.0 addressed using context_id instead of message_id, but didn't handle the case where context_id itself is a UUID (generated by the A2A protocol when no context exists).
The root cause: On the first A2A call, there's no existing context_id in metadata (remote_a2a_agent.py:358-368), so context_id=None is passed.
The A2A server library then generates a new UUID as context_id (standard A2A protocol behavior), which becomes "01e8a9db-b093-47c1-9e89-3c0e7b321c12" in your log.
This UUID is then used as session_id for VertexAI (request_converter.py:111), which VertexAI rejects.
The workaround for now is to use InMemorySessionService instead of VertexAiSessionService for A2A agents, or implement a custom request converter that transforms UUID context_ids into VertexAI-compatible session IDs before calling get_session.
A proper fix would require the A2A executor to detect VertexAiSessionService and handle UUID context_ids appropriately.
3 remaining items
surajksharma07 commentedon Dec 18, 2025
@DeanChensj Please have a look into it.
ftnext commentedon Jan 31, 2026
@DeanChensj @surajksharma07 Please review & merge #4340
adk-bot commentedon Mar 6, 2026
This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.
ftnext commentedon Mar 6, 2026
@DeanChensj @surajksharma07 Please review & merge #4340
surajksharma07 commentedon Mar 6, 2026
@seanzhou1023 Please have a look into it once.
ftnext commentedon Mar 8, 2026
@surajksharma07 @seanzhou1023 Thanks so much for taking a look at this issue and the PR.
I’ve now resolved the merge conflicts in the PR: #4340 (comment)
I also want to emphasize the impact: this has effectively blocked using
VertexAiSessionServicewith A2A for more than six months, which has been extremely disruptive for us in practice.We’ve been heavily affected by this, so we’d really appreciate prioritizing a review/merge when possible.
ftnext commentedon Apr 18, 2026
Re-tested on ADK 1.31.0 and this no longer reproduces #2727 (comment)
RemoteA2aAgentcompleted successfully,and Vertex AI Agent Engine created a session with a UUID session ID.
So this looks fixed now and can probably be closed.
Maybe e1913a6 on v1.29.0 fixed.
Thanks.
ftnext commentedon Apr 18, 2026