Skip to content

[BUG] Pydantic ValidationError when sending message after editing markdown table in Canvas #2116

@epamLDadayan

Description

@epamLDadayan

Description:
After editing a markdown table in Canvas, the next chat message fails because AIMessage.content is serialized as a list (with dict segments and a None) instead of a plain string. This triggers a pydantic_core ValidationError.

Steps to reproduce:

  1. In Chat, ask the model to “create a sample markdown table.”
  2. Open the table in Canvas and edit any cell.
  3. Send a new message in the chat.

Actual Result:
Message fails with:

  • pydantic_core.ValidationError for AIMessage
  • content.str: “Input should be a valid string”
  • content.list[…].2.str/dict: “Input should be a valid string/dictionary”, input_value=None

Expected Result:
Message sends successfully. Canvas edits are serialized back to valid plain markdown (string), with no validation errors.

Note: Reproducable in Stage and NEXT envs.

pydantic_core._pydantic_core.ValidationError: 3 validation errors for AIMessage
content.str
Input should be a valid string [type=string_type, input_value=[{'type': 'text', 'text':...perly formatted table'}], input_type=list]
For further information visit https://errors.pydantic.dev/2.10/v/string_type
content.list[union[str,dict[any,any]]].2.str
Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
For further information visit https://errors.pydantic.dev/2.10/v/string_type
content.list[union[str,dict[any,any]]].2.dict[any,any]
Input should be a valid dictionary [type=dict_type, input_value=None, input_type=NoneType]
For further information visit https://errors.pydantic.dev/2.10/v/dict_type

Metadata

Metadata

Labels

CanvasTo group issues regarding Canvas functionalityChatTo group issues regarding Chat functionality

Type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions