Gemini Plugin with "JSON Schema" fail 'NoneType' object has no attribute 'upper' #250

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

Originally created by @tanreinama on GitHub (May 6, 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.3.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When using LLM with the Gemini plugin, if you set a JSON Schema, the error 'NoneType' object has no attribute 'upper' occurs. If you do not set a JSON Schema, the error does not occur.

Image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @tanreinama on GitHub (May 6, 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.3.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When using LLM with the Gemini plugin, if you set a JSON Schema, the error 'NoneType' object has no attribute 'upper' occurs. If you do not set a JSON Schema, the error does not occur. ![Image](https://github.com/user-attachments/assets/9c21ebd1-f4b8-47ed-99ef-cbd17ac52360) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-16 10:18:36 -05:00
Author
Owner

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

Hello @tanreinama! I'm Dosu, here to help you with any bugs, questions, or contributions you might have. While we wait for a human maintainer, feel free to share more details or ask away!

The error you're encountering, 'NoneType' object has no attribute 'upper', typically occurs when a variable expected to be a string (or another type with an upper method) is actually None. In the context of the Dify platform, this issue might be related to how the JSON Schema is being processed or how the Gemini plugin interacts with it.

Here are a few steps you can take to troubleshoot and potentially resolve this issue:

  1. Check JSON Schema Configuration: Ensure that the JSON Schema is correctly defined and that all required fields are present. An improperly configured schema might lead to unexpected None values.

  2. Review Plugin Code: If you have access to the plugin code, look for any operations that call .upper() on variables that might not be strings. This could help identify where the None value is being introduced.

  3. Update to Latest Version: Ensure that you are using the latest version of the Dify platform and the Gemini plugin. There might be bug fixes or improvements that address this issue.

  4. Error Handling: Implement error handling around the code that processes the JSON Schema to catch and manage NoneType errors gracefully.

If the issue persists, consider checking the Dify issue tracker for any similar reports or updates related to this problem.

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 6, 2025): <!-- Greeting --> Hello @tanreinama! I'm [Dosu](https://dosu.dev), here to help you with any bugs, questions, or contributions you might have. While we wait for a human maintainer, feel free to share more details or ask away! <!-- Answer --> The error you're encountering, `'NoneType' object has no attribute 'upper'`, typically occurs when a variable expected to be a string (or another type with an `upper` method) is actually `None`. In the context of the Dify platform, this issue might be related to how the JSON Schema is being processed or how the Gemini plugin interacts with it. Here are a few steps you can take to troubleshoot and potentially resolve this issue: 1. **Check JSON Schema Configuration**: Ensure that the JSON Schema is correctly defined and that all required fields are present. An improperly configured schema might lead to unexpected `None` values. 2. **Review Plugin Code**: If you have access to the plugin code, look for any operations that call `.upper()` on variables that might not be strings. This could help identify where the `None` value is being introduced. 3. **Update to Latest Version**: Ensure that you are using the latest version of the Dify platform and the Gemini plugin. There might be bug fixes or improvements that address this issue. 4. **Error Handling**: Implement error handling around the code that processes the JSON Schema to catch and manage `NoneType` errors gracefully. If the issue persists, consider checking the Dify issue tracker for any similar reports or updates related to this problem. <!-- 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/d5316266-16df-4e76-914f-fa6c3dc97ebf?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/d5316266-16df-4e76-914f-fa6c3dc97ebf?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/d5316266-16df-4e76-914f-fa6c3dc97ebf?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/d5316266-16df-4e76-914f-fa6c3dc97ebf?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/d5316266-16df-4e76-914f-fa6c3dc97ebf?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/d5316266-16df-4e76-914f-fa6c3dc97ebf?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/d5316266-16df-4e76-914f-fa6c3dc97ebf?feedback_type=other)</sup>
Author
Owner

@fdb02983rhy commented on GitHub (Jun 21, 2025):

Please input a valid json schema.

Image
@fdb02983rhy commented on GitHub (Jun 21, 2025): Please input a valid json schema. <img width="1196" alt="Image" src="https://github.com/user-attachments/assets/5f341586-b4d5-4960-800a-d888c0735bcc" />
Author
Owner

@tanreinama commented on GitHub (Jun 21, 2025):

Thank you @fdb02983rhy
Is there any documentation somewhere that explains this schema?

@tanreinama commented on GitHub (Jun 21, 2025): Thank you @fdb02983rhy Is there any documentation somewhere that explains this schema?
Author
Owner

@fdb02983rhy commented on GitHub (Jun 21, 2025):

Thank you @fdb02983rhy Is there any documentation somewhere that explains this schema?

https://docs.dify.ai/en/learn-more/extended-reading/how-to-use-json-schema-in-dify

@fdb02983rhy commented on GitHub (Jun 21, 2025): > Thank you [@fdb02983rhy](https://github.com/fdb02983rhy) Is there any documentation somewhere that explains this schema? https://docs.dify.ai/en/learn-more/extended-reading/how-to-use-json-schema-in-dify
Author
Owner

@tanreinama commented on GitHub (Jun 21, 2025):

Thanks.
I hope that Gemini will be added to the list of Models Supporting JSON Schema Functionality.

@tanreinama commented on GitHub (Jun 21, 2025): Thanks. I hope that Gemini will be added to the list of Models Supporting JSON Schema Functionality.
Author
Owner

@fdb02983rhy commented on GitHub (Jun 21, 2025):

Those models in the docs are just examples. All models with json schema option should support the feature.

@fdb02983rhy commented on GitHub (Jun 21, 2025): Those models in the docs are just examples. All models with json schema option should support the feature.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#250