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
Error adk_web_server.py:1431 - Error in event_generator: Failed to parse the parameter file_patterns: List[str] | None = None of function cleanup_unused_files #3591
good first issue[Community] This issue is good for newcomers to participateneeds review[Status] The PR/issue is awaiting review from the maintainerweb[Component] This issue will be transferred to adk-web
** Please make sure you read the contribution guide and file the issues in the right place. ** Contribution guide.
Describe the bug
When I tried to edit an agent in builder mode in adk web, I got the following error:
adk_web_server.py:1431 - Error in event_generator: Failed to parse the parameter file_patterns: List[str] | None = None of function cleanup_unused_files for automatic function calling. Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function cleanup_unused_files.
I was not able to use the AI chat to interact with builder.
To Reproduce
Steps to reproduce the behavior:
Install adk.
run adk web
Open adk web editor, create a new agent.
Error in console: adk_web_server.py:1431 - Error in event_generator: Failed to parse the parameter file_patterns: List[str] | None = None of function cleanup_unused_files for automatic function calling. Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function cleanup_unused_files.
Expected behavior
I was expecting to use the assistant to create the agent.
Screenshots
N/A, no aparent error on the UI
Desktop (please complete the following information):
@rrbemfica The issue is that ADK's function parser doesn't support Python 3.10+ pipe operator union syntax (|) in function signatures.
As a workaround, replace List[str] | None with Union[List[str], None] from the typing module, or better yet, make the parameter required (List[str]) and handle the None case inside your function.
This will allow the web builder to parse your functions correctly.
@rrbemfica The issue is that ADK's function parser doesn't support Python 3.10+ pipe operator union syntax (|) in function signatures. As a workaround, replace List[str] | None with Union[List[str], None] from the typing module, or better yet, make the parameter required (List[str]) and handle the None case inside your function. This will allow the web builder to parse your functions correctly. Thanks!
@busbaby the documentation shows the modern pipe operator syntax because that's the recommended Python 3.10+ style, but the parser hasn't been updated to support it yet.
This is definitely a bug in the parser that needs fixing.
We'll prioritize updating the parser to handle both Union[X, Y] and X | Y syntax so it matches what the docs show.
Thanks!
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.
good first issue[Community] This issue is good for newcomers to participateneeds review[Status] The PR/issue is awaiting review from the maintainerweb[Component] This issue will be transferred to adk-web
Activity
DeanChensj commentedon Nov 19, 2025
Hi @ymodak , could your team help reproduce before assign this back to @wyf7107 ? Thanks!
surajksharma07 commentedon Nov 19, 2025
@rrbemfica The issue is that ADK's function parser doesn't support Python 3.10+ pipe operator union syntax (|) in function signatures.
As a workaround, replace
List[str] | NonewithUnion[List[str], None]from the typing module, or better yet, make the parameter required (List[str]) and handle the None case inside your function.This will allow the web builder to parse your functions correctly.
Thanks!
busbaby commentedon Nov 30, 2025
Is the documentation incorrect, then?
https://google.github.io/adk-docs/tools-custom/function-tools/#required-parameters
Is the parser broken, or the documentation wrong. Either way, something needs to get fixed.
surajksharma07 commentedon Nov 30, 2025
@busbaby the documentation shows the modern pipe operator syntax because that's the recommended Python 3.10+ style, but the parser hasn't been updated to support it yet.
This is definitely a bug in the parser that needs fixing.
We'll prioritize updating the parser to handle both
Union[X, Y]andX | Ysyntax so it matches what the docs show.Thanks!
11 remaining items
adk-bot commentedon Apr 26, 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.
mahesh-github commentedon May 28, 2026
Can I take this issue
docs: add reproduction script for issue google#3591
docs: add reproduction script for issue google#3591
chore: Add coverage for pipe union list annotations
guptaishaan commentedon Jul 28, 2026
Put together a fix in #6502.
guptaishaan commentedon Jul 30, 2026
PR up at #6517.
guptaishaan commentedon Jul 31, 2026
PR up at #6536.
guptaishaan commentedon Aug 1, 2026
PR up at #6549.
guptaishaan commentedon Aug 2, 2026
Put together a fix in #6552.
chore: Add coverage for pipe union list annotations
fix: use typing.Optional in cleanup_unused_files to fix parse error