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
TypeError in LoadSkillTool.run_async after session rewind: 'NoneType' object is not iterable #5193
Since the key exists with value None, dict.get() returns None (not the default []), and list(None) raises TypeError.
Stack Trace
File ".../google/adk/tools/skill_toolset.py", line 155, in run_async
activated_skills = list(tool_context.state.get(state_key, []))
TypeError: 'NoneType' object is not iterable
Suggested Fix
# skill_toolset.py:155activated_skills=list(tool_context.state.get(state_key) or [])
This handles both missing keys and explicit None values. The same pattern should be applied to _resolve_additional_tools_from_state (line 742) for consistency, even though it currently doesn't crash due to the if not activated_skills guard on line 744.
@SAMFVH The rewind path sets adk_activated_skill{agent_name} to None as a deletion marker, and dict.get(key, default) only falls back to the default when the key is absent — not when it's explicitly None — so list(None) blows up.
As a quick workaround, try swapping line 155 in skill_toolset.py from state.get(state_key, []) to state.get(state_key) or [] and see if that clears the crash on your end.
Commit cb5d1f8 is already heading in this direction, but it'd be great if you could test it thoroughly on your setup.
We ran into this in production. Our workaround patches all 3 crash sites from our side:
LoadSkillTool.run_async (line 155) — subclassed LoadSkillTool to normalize None → [] in state before calling super().run_async()
SkillToolset._resolve_additional_tools_from_state (line 742) — overrode in our SkillToolset subclass to normalize via the underlying session.state (since ReadonlyContext.state is a MappingProxyType)
Our own activate_skill_for_step that also reads the same state key — switched from list(state.get(key, [])) to list(raw) if raw is not None else []
Happy to see this fixed upstream so we can drop the workarounds. The suggested state.get(key) or [] would work for all 3 sites.
@SAMFVH — thanks for the detailed production breakdown, really helpful to have that level of context!
PR #5204 applies the or [] guard to both sites in skill_toolset.py (line 155 and line 742), which should cover crash sites 1 and 2 on your end.
Site 3 is in your own activate_skill_for_step code, so that one stays with you.
Keep an eye on #5204 for the merge — once it lands you should be able to drop the subclass workarounds entirely!
Activity
Fix google#5193: Handle None in LoadSkillTool.run_async and _resolve_…
enjoykumawat commentedon Apr 7, 2026
I'd like to work on this. Adding a None guard before iterating in
LoadSkillTool.run_async. Will submit a PR shortly.surajksharma07 commentedon Apr 7, 2026
@SAMFVH The rewind path sets adk_activated_skill{agent_name} to None as a deletion marker, and dict.get(key, default) only falls back to the default when the key is absent — not when it's explicitly None — so list(None) blows up.
As a quick workaround, try swapping line 155 in skill_toolset.py from state.get(state_key, []) to state.get(state_key) or [] and see if that clears the crash on your end.
Commit cb5d1f8 is already heading in this direction, but it'd be great if you could test it thoroughly on your setup.
SAMFVH commentedon Apr 7, 2026
We ran into this in production. Our workaround patches all 3 crash sites from our side:
LoadSkillTool.run_async(line 155) — subclassedLoadSkillToolto normalizeNone→[]in state before callingsuper().run_async()SkillToolset._resolve_additional_tools_from_state(line 742) — overrode in ourSkillToolsetsubclass to normalize via the underlyingsession.state(sinceReadonlyContext.stateis aMappingProxyType)activate_skill_for_stepthat also reads the same state key — switched fromlist(state.get(key, []))tolist(raw) if raw is not None else []Happy to see this fixed upstream so we can drop the workarounds. The suggested
state.get(key) or []would work for all 3 sites.fix: handle None state values in skill_toolset after session rewind
surajksharma07 commentedon Apr 9, 2026
@SAMFVH — thanks for the detailed production breakdown, really helpful to have that level of context!
PR #5204 applies the or [] guard to both sites in skill_toolset.py (line 155 and line 742), which should cover crash sites 1 and 2 on your end.
Site 3 is in your own activate_skill_for_step code, so that one stays with you.
Keep an eye on #5204 for the merge — once it lands you should be able to drop the subclass workarounds entirely!
Team is looking more into it.
surajksharma07 commentedon Apr 15, 2026
@xuanyang15 Please have a look into it once.
xuanyang15 commentedon Apr 16, 2026
PR merged in a977aa3.