Skip to content

TypeError: Object of type HumanMessage is not JSON serializable #235

@kkwcode

Description

@kkwcode

got error TypeError: Object of type HumanMessage is not JSON serializable

when upgrade langgraph-checkpoint-postgres version to 2.0.23, got error; i must lock the version to 2.0.21, the error is gone.

error condition

  • langgraph-checkpoint-postgres==2.0.21 ==> langgraph-checkpoint-postgres==2.0.23
  • langgraph==0.4.10
  • langgraph-checkpoint==2.1.0
  • openai==1.97.0

error detail

INFO: Waiting for connections to close. (CTRL+C to force quit)
ERROR: Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_utils.py", line 76, in collapse_excgroups
    | yield
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/responses.py", line 263, in call
    | async with anyio.create_task_group() as task_group:
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_anyio/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_uvicorn/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_uvicorn/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_fastapi/site-packages/fastapi/applications.py", line 1054, in call
    | await super().call(scope, receive, send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/applications.py", line 112, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/middleware/errors.py", line 187, in call
    | raise exc
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/middleware/errors.py", line 165, in call
    | await self.app(scope, receive, _send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/middleware/exceptions.py", line 62, in call
    | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    | raise exc
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    | await app(scope, receive, sender)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 714, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 734, in app
    | await route.handle(scope, receive, send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 288, in handle
    | await self.app(scope, receive, send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 76, in app
    | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    | raise exc
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    | await app(scope, receive, sender)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 74, in app
    | await response(scope, receive, send)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/responses.py", line 262, in call
    | with collapse_excgroups():
    | ^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/contextlib.py", line 158, in exit
    | self.gen.throw(value)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
    | raise exc
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/responses.py", line 266, in wrap
    | await func()
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/responses.py", line 246, in stream_response
    | async for chunk in self.body_iterator:
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_copilotkit/site-packages/copilotkit/langgraph_agent.py", line 375, in _stream_events
    | async for event in self.graph.astream_events(stream_input, config, version="v2"):
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langchain_core/site-packages/langchain_core/runnables/base.py", line 1403, in astream_events
    | async for event in event_stream:
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langchain_core/site-packages/langchain_core/tracers/event_stream.py", line 1021, in _astream_events_implementation_v2
    | await task
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langchain_core/site-packages/langchain_core/tracers/event_stream.py", line 976, in consume_astream
    | async for _ in event_streamer.tap_output_aiter(run_id, stream):
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langchain_core/site-packages/langchain_core/tracers/event_stream.py", line 204, in tap_output_aiter
    | async for chunk in output:
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/init.py", line 2596, in astream
    | async with AsyncPregelLoop(
    | ^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/loop.py", line 1393, in aexit
    | return await exit_task
    | ^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/contextlib.py", line 754, in aexit
    | raise exc_details[1]
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/contextlib.py", line 737, in aexit
    | cb_suppress = await cb(*exc_details)
    | ^^^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/executor.py", line 209, in aexit
    | raise exc
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/loop.py", line 1260, in _checkpointer_put_after_previous
    | await prev
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/executor.py", line 217, in gated
    | return await coro
    | ^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/loop.py", line 1260, in _checkpointer_put_after_previous
    | await prev
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/executor.py", line 217, in gated
    | return await coro
    | ^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/loop.py", line 1262, in _checkpointer_put_after_previous
    | await cast(BaseCheckpointSaver, self.checkpointer).aput(
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph_checkpoint_postgres/site-packages/langgraph/checkpoint/postgres/aio.py", line 280, in aput
    | await cur.execute(
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/cursor_async.py", line 93, in execute
    | await self._conn.wait(
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/connection_async.py", line 439, in wait
    | return await waiting.wait_async(gen, self.pgconn.socket, interval=interval)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/waiting.py", line 131, in wait_async
    | s = next(gen)
    | ^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/_cursor_base.py", line 194, in _execute_gen
    | pgq = self._convert_query(query, params)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/_cursor_base.py", line 453, in _convert_query
    | pgq.convert(query, params)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/_queries.py", line 95, in convert
    | self.dump(vars)
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/_queries.py", line 106, in dump
    | self.params = self._tx.dump_sequence(params, self._want_formats)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "psycopg_binary/_psycopg/transform.pyx", line 351, in psycopg_binary._psycopg.Transformer.dump_sequence
    | File "psycopg_binary/_psycopg/transform.pyx", line 402, in psycopg_binary._psycopg.Transformer.dump_sequence
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/types/json.py", line 149, in dump
    | if isinstance((data := dumps(obj)), str):
    | ^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/json/init.py", line 231, in dumps
    | return _default_encoder.encode(obj)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/json/encoder.py", line 200, in encode
    | chunks = self.iterencode(o, _one_shot=True)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/json/encoder.py", line 258, in iterencode
    | return _iterencode(o, 0)
    | ^^^^^^^^^^^^^^^^^
    | File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/json/encoder.py", line 180, in default
    | raise TypeError(f'Object of type {o.class.name} '
    | TypeError: Object of type HumanMessage is not JSON serializable
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_uvicorn/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_uvicorn/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_fastapi/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 714, in call
await self.middleware_stack(scope, receive, send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
raise exc
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/routing.py", line 74, in app
await response(scope, receive, send)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/responses.py", line 262, in call
with collapse_excgroups():
^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/contextlib.py", line 158, in exit
self.gen.throw(value)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
raise exc
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/responses.py", line 266, in wrap
await func()
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_starlette/site-packages/starlette/responses.py", line 246, in stream_response
async for chunk in self.body_iterator:
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_copilotkit/site-packages/copilotkit/langgraph_agent.py", line 375, in _stream_events
async for event in self.graph.astream_events(stream_input, config, version="v2"):
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langchain_core/site-packages/langchain_core/runnables/base.py", line 1403, in astream_events
async for event in event_stream:
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langchain_core/site-packages/langchain_core/tracers/event_stream.py", line 1021, in _astream_events_implementation_v2
await task
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langchain_core/site-packages/langchain_core/tracers/event_stream.py", line 976, in consume_astream
async for _ in event_streamer.tap_output_aiter(run_id, stream):
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langchain_core/site-packages/langchain_core/tracers/event_stream.py", line 204, in tap_output_aiter
async for chunk in output:
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/init.py", line 2596, in astream
async with AsyncPregelLoop(
^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/loop.py", line 1393, in aexit
return await exit_task
^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/contextlib.py", line 754, in aexit
raise exc_details[1]
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/contextlib.py", line 737, in aexit
cb_suppress = await cb(*exc_details)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/executor.py", line 209, in aexit
raise exc
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/loop.py", line 1260, in _checkpointer_put_after_previous
await prev
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/executor.py", line 217, in gated
return await coro
^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/loop.py", line 1260, in _checkpointer_put_after_previous
await prev
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/executor.py", line 217, in gated
return await coro
^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph/site-packages/langgraph/pregel/loop.py", line 1262, in _checkpointer_put_after_previous
await cast(BaseCheckpointSaver, self.checkpointer).aput(
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_langgraph_checkpoint_postgres/site-packages/langgraph/checkpoint/postgres/aio.py", line 280, in aput
await cur.execute(
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/cursor_async.py", line 93, in execute
await self._conn.wait(
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/connection_async.py", line 439, in wait
return await waiting.wait_async(gen, self.pgconn.socket, interval=interval)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/waiting.py", line 131, in wait_async
s = next(gen)
^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/_cursor_base.py", line 194, in _execute_gen
pgq = self._convert_query(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/_cursor_base.py", line 453, in _convert_query
pgq.convert(query, params)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/_queries.py", line 95, in convert
self.dump(vars)
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/_queries.py", line 106, in dump
self.params = self._tx.dump_sequence(params, self._want_formats)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "psycopg_binary/_psycopg/transform.pyx", line 351, in psycopg_binary._psycopg.Transformer.dump_sequence
File "psycopg_binary/_psycopg/transform.pyx", line 402, in psycopg_binary._psycopg.Transformer.dump_sequence
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/execroot/com_tencent/bazel-out/k8-fastbuild/bin/apps/fc/testcopilot/srcs/tchost/agent/server.runfiles/py_deps_3_12_psycopg/site-packages/psycopg/types/json.py", line 149, in dump
if isinstance((data := dumps(obj)), str):
^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/root/.cache/bazel/_bazel_root/f69f610f7cb944c71c7855b8427d317e/external/python_3_12_x86_64-unknown-linux-gnu/lib/python3.12/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type HumanMessage is not JSON serializable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions