-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugSomething isn't workingSomething isn't workingdata layerPertains to data layers.Pertains to data layers.keep-for-a-whileDon’t mark as stale. This label should be used only for confirmed bugs or other important thingsDon’t mark as stale. This label should be used only for confirmed bugs or other important things
Description
Describe the bug
chainlit/backend/chainlit/data/chainlit_data_layer.py
Lines 374 to 377 in 0e863ae
timestamp = await self.get_current_timestamp() | |
created_at = step_dict.get("createdAt") | |
if created_at: | |
timestamp = datetime.strptime(created_at, ISO_FORMAT) |
Saves in UTC (with Z), but
createdAt=row["createdAt"].isoformat() if row.get("createdAt") else None, |
reads in local time (without Z)
and when system tries to save it again we get exception
2025-09-03 22:00:48 - Task exception was never retrieved
future: <Task finished name='Task-1150' coro=<ChainlitDataLayer.update_step() done, defined at /Users/dmitriy/Documents/GitHub/cookbook/resume-chat/.venv/lib/python3.13/site-packages/chainlit/data/utils.py:10> exception=ValueError("time data '2025-09-04T02:00:42.164000' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'")>
Traceback (most recent call last):
File "/opt/homebrew/Cellar/[email protected]/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/tasks.py", line 304, in __step_run_and_handle_result
result = coro.send(None)
File "/Users/dmitriy/Documents/GitHub/cookbook/resume-chat/.venv/lib/python3.13/site-packages/chainlit/data/utils.py", line 25, in wrapper
return await method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dmitriy/Documents/GitHub/cookbook/resume-chat/.venv/lib/python3.13/site-packages/chainlit/data/chainlit_data_layer.py", line 388, in update_step
await self.create_step(step_dict)
File "/Users/dmitriy/Documents/GitHub/cookbook/resume-chat/.venv/lib/python3.13/site-packages/chainlit/data/utils.py", line 25, in wrapper
return await method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/dmitriy/Documents/GitHub/cookbook/resume-chat/.venv/lib/python3.13/site-packages/chainlit/data/chainlit_data_layer.py", line 368, in create_step
timestamp = datetime.strptime(created_at, ISO_FORMAT)
File "/opt/homebrew/Cellar/[email protected]/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_strptime.py", line 674, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.13.3/Frameworks/Python.framework/Versions/3.13/lib/python3.13/_strptime.py", line 453, in _strptime
raise ValueError("time data %r does not match format %r" %
(data_string, format))
ValueError: time data '2025-09-04T02:00:42.164000' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'
when returned back to data layer and it tries to update thread step
To Reproduce
See #2486
Expected behavior
UTC should be saved returned
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdata layerPertains to data layers.Pertains to data layers.keep-for-a-whileDon’t mark as stale. This label should be used only for confirmed bugs or other important thingsDon’t mark as stale. This label should be used only for confirmed bugs or other important things