Error when using tools with Vertex AI models #302

Closed
opened 2026-02-16 10:18:54 -05:00 by yindo · 3 comments
Owner

Originally created by @ghwany on GitHub (May 20, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.4.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

After adding the tool to the gemini-2.5-flash-preview-04-17 model in Vertex AI, the following error occurs when queried.

Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [vertex_ai] Error: PluginInvokeError: {"args":{"description":"[models] Error: module 'vertexai.generative_models' has no attribute 'Schema'"},"error_type":"InvokeError","message":"[models] Error: module 'vertexai.generative_models' has no attribute 'Schema'"}"}

Other models in Vertex AI have the same issue and work fine when I remove the tool.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @ghwany on GitHub (May 20, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.4.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="860" alt="Image" src="https://github.com/user-attachments/assets/9b4daa0e-d6b1-432e-802e-420475f7ff4a" /> After adding the tool to the `gemini-2.5-flash-preview-04-17` model in Vertex AI, the following error occurs when queried. ``` Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [vertex_ai] Error: PluginInvokeError: {"args":{"description":"[models] Error: module 'vertexai.generative_models' has no attribute 'Schema'"},"error_type":"InvokeError","message":"[models] Error: module 'vertexai.generative_models' has no attribute 'Schema'"}"} ``` Other models in Vertex AI have the same issue and work fine when I remove the tool. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-16 10:18:54 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 20, 2025):

Hello @ghwany! I'm Dosu, your friendly bot here to help you solve bugs, answer questions, and guide you towards becoming a contributor. While you wait for a human maintainer, feel free to let me know how I can assist you! 🐾

To resolve the PluginInvokeError related to the missing Schema attribute in the vertexai.generative_models module when using the gemini-2.5-flash-preview-04-17 model with tools in Vertex AI, you need to disable both the JSON Schema setting and agent tools. The model does not support JSON Schema functionality, which leads to the error [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (May 20, 2025): <!-- Greeting --> Hello @ghwany! I'm [Dosu](https://dosu.dev), your friendly bot here to help you solve bugs, answer questions, and guide you towards becoming a contributor. While you wait for a human maintainer, feel free to let me know how I can assist you! 🐾 <!-- Answer --> To resolve the `PluginInvokeError` related to the missing `Schema` attribute in the `vertexai.generative_models` module when using the `gemini-2.5-flash-preview-04-17` model with tools in Vertex AI, you need to disable both the JSON Schema setting and agent tools. The model does not support JSON Schema functionality, which leads to the error <sup>[[1]](https://github.com/langgenius/dify/issues/12545)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/8625f8e8-cc5d-49dc-a530-ee5a6068143a?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/8625f8e8-cc5d-49dc-a530-ee5a6068143a?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/8625f8e8-cc5d-49dc-a530-ee5a6068143a?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/8625f8e8-cc5d-49dc-a530-ee5a6068143a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8625f8e8-cc5d-49dc-a530-ee5a6068143a?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/8625f8e8-cc5d-49dc-a530-ee5a6068143a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8625f8e8-cc5d-49dc-a530-ee5a6068143a?feedback_type=other)</sup>
Author
Owner

@jortegac commented on GitHub (May 26, 2025):

I've been trying to use my custom tool with Gemini through the Vertex plugin. I updated the Gemini plugin to 0.0.15 which has this fix in place.

I used the get the same error as the original comment, now I get the following error:

[vertex_ai] Error: PluginInvokeError: {"args":{},"error_type":"TypeError","message":"'Tool' object is not iterable"}

Context:

  • Self hosted Dify v.1.2.0
  • My tool is a custom OpenAPI based tool
  • With other tools like currentTime it also has the same issue
@jortegac commented on GitHub (May 26, 2025): I've been trying to use my custom tool with Gemini through the Vertex plugin. I updated the Gemini plugin to 0.0.15 which has this fix in place. I used the get the same error as the original comment, now I get the following error: ``` [vertex_ai] Error: PluginInvokeError: {"args":{},"error_type":"TypeError","message":"'Tool' object is not iterable"} ``` Context: - Self hosted Dify v.1.2.0 - My tool is a custom OpenAPI based tool - With other tools like `currentTime` it also has the same issue
Author
Owner

@ghwany commented on GitHub (May 28, 2025):

I've been trying to use my custom tool with Gemini through the Vertex plugin. I updated the Gemini plugin to 0.0.15 which has this fix in place.

I used the get the same error as the original comment, now I get the following error:

[vertex_ai] Error: PluginInvokeError: {"args":{},"error_type":"TypeError","message":"'Tool' object is not iterable"}

Context:

  • Self hosted Dify v.1.2.0
  • My tool is a custom OpenAPI based tool
  • With other tools like currentTime it also has the same issue

I made the changes and registered the PR. #991
Thx u.

@ghwany commented on GitHub (May 28, 2025): > I've been trying to use my custom tool with Gemini through the Vertex plugin. I updated the Gemini plugin to 0.0.15 which has this fix in place. > > I used the get the same error as the original comment, now I get the following error: > > ``` > [vertex_ai] Error: PluginInvokeError: {"args":{},"error_type":"TypeError","message":"'Tool' object is not iterable"} > ``` > > Context: > > * Self hosted Dify v.1.2.0 > * My tool is a custom OpenAPI based tool > * With other tools like `currentTime` it also has the same issue I made the changes and registered the PR. #991 Thx u.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#302