Skip to content

fix: handle None state values in skill_toolset after session rewind#5204

Open
enjoykumawat wants to merge 1 commit intogoogle:mainfrom
enjoykumawat:fix/load-skill-tool-none-guard
Open

fix: handle None state values in skill_toolset after session rewind#5204
enjoykumawat wants to merge 1 commit intogoogle:mainfrom
enjoykumawat:fix/load-skill-tool-none-guard

Conversation

@enjoykumawat
Copy link
Copy Markdown

Summary

Fixes #5193 — After session rewind, LoadSkillTool.run_async crashes with TypeError: 'NoneType' object is not iterable.

Root cause: Session rewind sets adk_activated_skill_{agent_name} to None as a deletion marker. dict.get(key, default) only returns the default when the key is absent — when the key exists with value None, it returns None. So list(None) raises TypeError.

Fix: Change state.get(state_key, []) to state.get(state_key) or [] at both call sites (lines 155 and 794) so that explicit None values fall back to an empty list.

As identified by @surajksharma07 in the issue comments and confirmed in production by @SAMFVH.

Changes

  • src/google/adk/tools/skill_toolset.py: Fix both state.get() calls to handle explicit None

Test plan

  • All 78 test_skill_toolset.py tests pass
  • No regressions

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: google#5193
Reported-by: SAMFVH
@adk-bot adk-bot added the tools [Component] This issue is related to tools label Apr 8, 2026
@rohityan rohityan self-assigned this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError in LoadSkillTool.run_async after session rewind: 'NoneType' object is not iterable

3 participants