Repository navigation
Description
Describe the bug
When using the Gemini provider with any skill (e.g., the email skill), the agent crashes during the chat_stream process. This is caused by a ValueError: Unknown field for Schema: default inside the Google Generative AI SDK. The bug occurs because PythonClaw generates a tool schema that includes default values for parameters, which the Gemini SDK's Protobuf definitions do not support, leading to a validation failure when preparing the request.
To Reproduce
Steps to reproduce:
Configure pythonclaw.json to use the gemini provider (e.g., gemini-2.0-flash).
Enable the email skill (or any skill with defined parameters).
Run the agent and start a chat.
Ask the agent to use the skill (e.g., "Send an email to test@example.com").
The agent will crash with a TypeError and ValueError regarding the Schema.
Expected behavior
The agent should successfully convert the skill's JSON schema into a format compatible with Gemini's API, ignoring or stripping fields like default that are not supported by the Google SDK, allowing the model to perform function calling without crashing.
Environment
OS: Linux (based on path /home/soren/anaconda3/...)
Python version: 3.11
PythonClaw version: [Indsæt din version, f.eks. 0.1.5]
LLM provider: Gemini (Google)
Logs
2026-05-12 11:06:19,236 [ERROR] pythonclaw.core.agent: Critical error in Agent.chat_stream()
Traceback (most recent call last):
File "/home/soren/anaconda3/envs/ddd/lib/python3.11/site-packages/proto/marshal/rules/message.py", line 36, in to_proto
return self._descriptor(**value)
TypeError: Parameter to CopyFrom() must be instance of same class: expected <class 'Schema'> got <class 'dict'>.
During handling of the above exception, another exception occurred:
ValueError: Protocol message Schema has no "default" field.
...
File "/home/soren/anaconda3/envs/ddd/lib/python3.11/site-packages/pythonclaw/core/llm/gemini_client.py", line 104, in chat
response = self.model.generate_content(
File "/home/soren/anaconda3/envs/ddd/lib/python3.11/site-packages/google/generativeai/generative_models.py", line 305, in generate_content
request = self._prepare_request(...)
...
ValueError: Unknown field for Schema: default
Activity
v0.7.2: fix Gemini tool schemas (#2), add --version (#5) and local Wh…
ericwang915 commentedon Sep 5, 2026
Fixed in v0.7.2 (just released to PyPI).
The Gemini
Schemaproto rejects JSON-Schema keys likedefaultandadditionalProperties, and PythonClaw was passing tool parameter schemas through verbatim — so any skill or built-in tool with a default value crashed withUnknown field for Schema: default. Tool schemas are now recursively sanitized to the fields Gemini accepts before the request is built.pip install -U pythonclaw # 0.7.2Thanks for the detailed traceback — it pinpointed the exact line. Please reopen if you still hit it.