Pydantic parsing warnings when handling multimodal prompt_messages #13107

Closed
opened 2026-02-21 19:10:36 -05:00 by yindo · 2 comments
Owner

Originally created by @Nov1c444 on GitHub (Apr 18, 2025).

Originally assigned to: @Nov1c444 on GitHub.

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 (Source)

Steps to reproduce

  1. create a workflow with vision LLM node.
  2. upload an image and run the workflow.
  3. the warning shows in the console.
/Users/novicelee/pro/dify/api/.venv/lib/python3.12/site-packages/pydantic/main.py:388: UserWarning: Pydantic serializer warnings:
  PydanticSerializationUnexpectedValue: Expected `str` but got `list` with value `[TextPromptMessageContent...=<DETAIL.HIGH: 'high'>)]` - serialized value may not be as expected
  PydanticSerializationUnexpectedValue: Expected `PromptMessageContent` but got `TextPromptMessageContent` with value `TextPromptMessageContent(...TEXT: 'text'>, data='1')` - serialized value may not be as expected

✔️ Expected Behavior

No pydantic warnings appear in the console

Actual Behavior

Pydantic warnings appear in the console

Originally created by @Nov1c444 on GitHub (Apr 18, 2025). Originally assigned to: @Nov1c444 on GitHub. ### 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 (Source) ### Steps to reproduce 1. create a workflow with vision LLM node. 2. upload an image and run the workflow. 3. the warning shows in the console. ```bash /Users/novicelee/pro/dify/api/.venv/lib/python3.12/site-packages/pydantic/main.py:388: UserWarning: Pydantic serializer warnings: PydanticSerializationUnexpectedValue: Expected `str` but got `list` with value `[TextPromptMessageContent...=<DETAIL.HIGH: 'high'>)]` - serialized value may not be as expected PydanticSerializationUnexpectedValue: Expected `PromptMessageContent` but got `TextPromptMessageContent` with value `TextPromptMessageContent(...TEXT: 'text'>, data='1')` - serialized value may not be as expected ``` ### ✔️ Expected Behavior No pydantic warnings appear in the console ### ❌ Actual Behavior Pydantic warnings appear in the console
yindo added the 🐞 bug label 2026-02-21 19:10:36 -05:00
yindo closed this issue 2026-02-21 19:10:36 -05:00
Author
Owner

@wx24736 commented on GitHub (Apr 19, 2025):

Dify version
1.2.0
Cloud or Self Hosted
Self Hosted (Source)

the error message is as follows:
/app/api/.venv/lib/python3.12/site-packages/pydantic/main.py:390: UserWarning: Pydantic serializer warnings: PydanticSerializationUnexpectedValue: Expected strbut gotlistwith value[ImagePromptMessageConten...=<DETAIL.HIGH: 'high'>)]- serialized value may not be as expected PydanticSerializationUnexpectedValue: ExpectedPromptMessageContentbut gotImagePromptMessageContentwith valueImagePromptMessageContent...l=<DETAIL.HIGH: 'high'>)- serialized value may not be as expected return self.__pydantic_serializer__.to_python(

@wx24736 commented on GitHub (Apr 19, 2025): Dify version 1.2.0 Cloud or Self Hosted Self Hosted (Source) the error message is as follows: `/app/api/.venv/lib/python3.12/site-packages/pydantic/main.py:390: UserWarning: Pydantic serializer warnings: PydanticSerializationUnexpectedValue: Expected `str` but got `list` with value `[ImagePromptMessageConten...=<DETAIL.HIGH: 'high'>)]` - serialized value may not be as expected PydanticSerializationUnexpectedValue: Expected `PromptMessageContent` but got `ImagePromptMessageContent` with value `ImagePromptMessageContent...l=<DETAIL.HIGH: 'high'>)` - serialized value may not be as expected return self.__pydantic_serializer__.to_python( `
Author
Owner

@Nov1c444 commented on GitHub (Apr 20, 2025):

Dify version 1.2.0 Cloud or Self Hosted Self Hosted (Source)

the error message is as follows: /app/api/.venv/lib/python3.12/site-packages/pydantic/main.py:390: UserWarning: Pydantic serializer warnings: PydanticSerializationUnexpectedValue: Expected strbut gotlistwith value[ImagePromptMessageConten...=<DETAIL.HIGH: 'high'>)]- serialized value may not be as expected PydanticSerializationUnexpectedValue: ExpectedPromptMessageContentbut gotImagePromptMessageContentwith valueImagePromptMessageContent...l=<DETAIL.HIGH: 'high'>)- serialized value may not be as expected return self.__pydantic_serializer__.to_python(

It looks like the same issue, I gonna fix it.

@Nov1c444 commented on GitHub (Apr 20, 2025): > Dify version 1.2.0 Cloud or Self Hosted Self Hosted (Source) > > the error message is as follows: `/app/api/.venv/lib/python3.12/site-packages/pydantic/main.py:390: UserWarning: Pydantic serializer warnings: PydanticSerializationUnexpectedValue: Expected `str`but got`list`with value`[ImagePromptMessageConten...=<DETAIL.HIGH: 'high'>)]`- serialized value may not be as expected PydanticSerializationUnexpectedValue: Expected`PromptMessageContent`but got`ImagePromptMessageContent`with value`ImagePromptMessageContent...l=<DETAIL.HIGH: 'high'>)`- serialized value may not be as expected return self.__pydantic_serializer__.to_python(` It looks like the same issue, I gonna fix it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13107