Skip to content

RedisCache only accepts values that can be pickled #13171

Description

@codenprogressive

Bug Description

The flow takes an input and an Agent components. See attached.

Image Image

I'm using Redis for cache. Executing the flow will result into this error:

RedisCache only accepts values that can be pickled. 

Traceback (most recent call last):
  File "/langflow_install_workspace/langflow/src/backend/base/langflow/services/cache/service.py", line 245, in set
    if pickled := dill.dumps(value, recurse=True):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/langflow_install_workspace/langflow/.venv/lib/python3.12/site-packages/dill/_dill.py", line 289, in dumps
    dump(obj, file, protocol, byref, fmode, recurse, **kwds)#, strictio)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I did another test using chat input and Large Model components. I got a slight different error but all are pointing to /src/backend/base/langflow/services/cache/service.py , line if pickled := dill.dumps(value, recurse=True)

cannot pickle 'SSLContext' object

Traceback (most recent call last):
  File "/langflow_install_workspace/langflow/src/backend/base/langflow/api/build.py", line 349, in _build_vertex
    vertex_build_result = await graph.build_vertex(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/langflow_install_workspace/langflow/src/lfx/src/lfx/graph/graph/base.py", line 1624, in build_vertex
    await set_cache(key=vertex.id, data=vertex_dict)
  File "/langflow_install_workspace/langflow/src/backend/base/langflow/services/chat/service.py", line 37, in set_cache
    await self.cache_service.upsert(str(key), result_dict, lock=lock or self.async_cache_locks[key])
  File "/langflow_install_workspace/langflow/src/backend/base/langflow/services/cache/service.py", line 272, in upsert
    await self.set(key, value)
  File "/langflow_install_workspace/langflow/src/backend/base/langflow/services/cache/service.py", line 245, in set
    if pickled := dill.dumps(value, recurse=True):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/langflow_install_workspace/langflow/.venv/lib/python3.12/site-packages/dill/_dill.py", line 289, in dumps
    dump(obj, file, protocol, byref, fmode, recurse, **kwds)#, strictio)

Reproduction

  1. enable Redis Cache LANGFLOW_CACHE_TYPE=redis
  2. add two components: chat input and Large Model components
  3. ask a question
  4. error will popup

Expected behavior

If Redis does not support certain object then bypass that pickle action.

Who can help?

No response

Operating System

Linux (debian 12)

Langflow Version

1.9.3

Python Version

3.12

Screenshot

No response

Flow File

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions