A field error occurred when a local image file was uploaded to zhipu GLM4v #12721

Closed
opened 2026-02-21 19:08:42 -05:00 by yindo · 4 comments
Owner

Originally created by @Jimmy-L99 on GitHub (Apr 9, 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.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

begin node configures image input and uploads images locally, set image File to GLM4v node.

Image

Image

Image

Then make error:

Run failed: [zhipuai] Error: PluginInvokeError: {"args":{},"error_type":"ValidationError","message":"1 validation error for ModelInvokeLLMRequest\nprompt_messages.content.type\n Input should be \u003cPromptMessageContentType.TEXT: 'text'\u003e [type=literal_error, input_value='text', input_type=str]\n For further information visit [https://errors.pydantic.dev/2.8/v/literal_error"}](https://errors.pydantic.dev/2.8/v/literal_error%22%7D)

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Jimmy-L99 on GitHub (Apr 9, 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.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce begin node configures image input and uploads images locally, set image File to GLM4v node. ![Image](https://github.com/user-attachments/assets/963ba696-8ab4-42bb-8e21-ef29469ab5a8) ![Image](https://github.com/user-attachments/assets/0e9b6085-5b11-4d3a-96d6-9f759a68e7cd) ![Image](https://github.com/user-attachments/assets/77cd2cb2-aeb4-48fa-b171-ebaf681d9cfa) Then make error: `Run failed: [zhipuai] Error: PluginInvokeError: {"args":{},"error_type":"ValidationError","message":"1 validation error for ModelInvokeLLMRequest\nprompt_messages.content.type\n Input should be \u003cPromptMessageContentType.TEXT: 'text'\u003e [type=literal_error, input_value='text', input_type=str]\n For further information visit [https://errors.pydantic.dev/2.8/v/literal_error"}](https://errors.pydantic.dev/2.8/v/literal_error%22%7D) ` ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 19:08:42 -05:00
yindo closed this issue 2026-02-21 19:08:42 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 10, 2025):

A similar issue has been reported in the Dify repository, where a field error occurs when uploading a local image file to zhipu GLM4v, resulting in a validation error related to prompt_messages.content.type. This issue is likely caused by a type checking problem with multimodal prompt messages. The error message suggests that the input should be of type PromptMessageContentType.IMAGE, but there seems to be a mismatch in the expected type [1].

To resolve this, ensure that you are correctly initializing the ImagePromptMessageContent class for image inputs. Construct the image into this entity as part of the content list, and ensure the type is set to PromptMessageContentType.IMAGE. If you are using an older SDK version, consider upgrading to a compatible version, as this might help resolve the issue [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 (Apr 10, 2025): <!-- Answer --> A similar issue has been reported in the Dify repository, where a field error occurs when uploading a local image file to zhipu GLM4v, resulting in a validation error related to `prompt_messages.content.type`. This issue is likely caused by a type checking problem with multimodal prompt messages. The error message suggests that the input should be of type `PromptMessageContentType.IMAGE`, but there seems to be a mismatch in the expected type <sup>[[1]](https://github.com/langgenius/dify/issues/16353)</sup>. To resolve this, ensure that you are correctly initializing the `ImagePromptMessageContent` class for image inputs. Construct the image into this entity as part of the `content` list, and ensure the `type` is set to `PromptMessageContentType.IMAGE`. If you are using an older SDK version, consider upgrading to a compatible version, as this might help resolve the issue <sup>[[1]](https://github.com/langgenius/dify/issues/16353)</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/0d693ce1-e7e4-4be6-86db-6af9394bf8b0?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/0d693ce1-e7e4-4be6-86db-6af9394bf8b0?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/0d693ce1-e7e4-4be6-86db-6af9394bf8b0?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/0d693ce1-e7e4-4be6-86db-6af9394bf8b0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0d693ce1-e7e4-4be6-86db-6af9394bf8b0?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/0d693ce1-e7e4-4be6-86db-6af9394bf8b0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0d693ce1-e7e4-4be6-86db-6af9394bf8b0?feedback_type=other)</sup>
Author
Owner

@Jimmy-L99 commented on GitHub (Apr 10, 2025):

My SDK was install in Markplace, zhipuai version 0.0.7 langgenius 2025-03-18 20:59:04, and it is the only version. So what can I do?

@Jimmy-L99 commented on GitHub (Apr 10, 2025): My SDK was install in Markplace, zhipuai version 0.0.7 langgenius 2025-03-18 20:59:04, and it is the only version. So what can I do?
Author
Owner

@crazywoola commented on GitHub (Apr 10, 2025):

Zhipu does not contain system role, please move the prompt from system to user

@crazywoola commented on GitHub (Apr 10, 2025): Zhipu does not contain system role, please move the prompt from `system` to `user`
Author
Owner

@Jimmy-L99 commented on GitHub (Apr 10, 2025):

@crazywoola
Image
I am already move the prompt from system to user, but still have the same error.

In 0.15.3, this chatflow can work normally, but when I update to 1.2.0 today and use plugin, things go wrong.

@Jimmy-L99 commented on GitHub (Apr 10, 2025): @crazywoola ![Image](https://github.com/user-attachments/assets/51f56663-6ec8-4db5-8494-482d60f682ee) I am already move the prompt from system to user, but still have the same error. In 0.15.3, this chatflow can work normally, but when I update to 1.2.0 today and use plugin, things go wrong.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12721