Skip to content

Fix: Invalid data type for the value of modes#2931

Open
waleedabdeen wants to merge 1 commit into
Chainlit:mainfrom
waleedabdeen:fix/invalid-modes-datatype-in-query
Open

Fix: Invalid data type for the value of modes#2931
waleedabdeen wants to merge 1 commit into
Chainlit:mainfrom
waleedabdeen:fix/invalid-modes-datatype-in-query

Conversation

@waleedabdeen
Copy link
Copy Markdown

@waleedabdeen waleedabdeen commented May 22, 2026

Summary

This PR addresses the issue where the modes parameter was being passed as a dictionary rather than a JSON string. This caused a data type mismatch when inserting/updating the step in the database, leading to an error. This resolves issue #2930.

Problem Identification:
The existing code was passing the modes field directly without serializing it to a JSON string. Causing the step insert queries to fail.

Solution:
A single line of code (line 402) has been added in backend/chainlit/sql_alchemy.py::SQLAlchemyDataLayer to serialize the modes parameter to a JSON formatted string before being inserted into the database:

parameters["modes"] = json.dumps(step_dict.get("modes", {}))

Impact:
Fixed the data type issue when interacting with the database.
Ensured that the modes parameter is correctly stored and can be queried in the future.


Summary by cubic

Serialize the modes field to a JSON string before DB insert/update to fix the data type mismatch that caused step writes to fail.

Written for commit 5430cb1. Summary will update on new commits. Review in cubic

- Serialized the `modes` parameter in the step to a JSON formatted string.
This resolves issue Chainlit#2930.
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. backend Pertains to the Python backend. bug Something isn't working data layer Pertains to data layers. labels May 22, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Pertains to the Python backend. bug Something isn't working data layer Pertains to data layers. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant