From ad027fc1d282be4ae28f7154ea7fcd3610a62e8c Mon Sep 17 00:00:00 2001 From: Enjoy Kumawat Date: Wed, 8 Apr 2026 08:55:37 +0530 Subject: [PATCH] fix: handle None state values in skill_toolset after session rewind Session rewind sets state keys to None as deletion markers. dict.get() returns None (not the default) when the key exists with value None, causing list(None) to raise TypeError. Change `state.get(key, [])` to `state.get(key) or []` at both call sites so that explicit None values fall back to an empty list. Github-Issue: #5193 Reported-by: SAMFVH --- src/google/adk/tools/skill_toolset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/adk/tools/skill_toolset.py b/src/google/adk/tools/skill_toolset.py index 514cfee52f..1f9ffe1241 100644 --- a/src/google/adk/tools/skill_toolset.py +++ b/src/google/adk/tools/skill_toolset.py @@ -152,7 +152,7 @@ async def run_async( agent_name = tool_context.agent_name state_key = f"_adk_activated_skill_{agent_name}" - activated_skills = list(tool_context.state.get(state_key, [])) + activated_skills = list(tool_context.state.get(state_key) or []) if skill_name not in activated_skills: activated_skills.append(skill_name) tool_context.state[state_key] = activated_skills @@ -791,7 +791,7 @@ async def _resolve_additional_tools_from_state( agent_name = readonly_context.agent_name state_key = f"_adk_activated_skill_{agent_name}" - activated_skills = readonly_context.state.get(state_key, []) + activated_skills = readonly_context.state.get(state_key) or [] if not activated_skills: return []