Skip to content

[Bug] #2

Closed
Closed

Description

@officebotdk

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

  1. added
    bug
    on May 12, 2026
  2. added a commit that references this issue on Sep 5, 2026
  3. ericwang915 commented on Sep 5, 2026

    @ericwang915
    Owner

    Fixed in v0.7.2 (just released to PyPI).

    The Gemini Schema proto rejects JSON-Schema keys like default and additionalProperties, and PythonClaw was passing tool parameter schemas through verbatim — so any skill or built-in tool with a default value crashed with Unknown 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.2

    Thanks for the detailed traceback — it pinpointed the exact line. Please reopen if you still hit it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions