I keep getting this error nowadays. Any idea why?
2025-03-21 16:12:03 WARNING Retrying langchain_google_vertexai.chat_models._acompletion_with_retry.<locals>._completion_with_retry_inner in 4.0 seconds as it raised InvalidArgument: 400 Request contains an invalid argument..
2025-03-21 16:12:07 WARNING Retrying langchain_google_vertexai.chat_models._acompletion_with_retry.<locals>._completion_with_retry_inner in 4.0 seconds as it raised InvalidArgument: 400 Request contains an invalid argument..
2025-03-21 16:12:11 WARNING Retrying langchain_google_vertexai.chat_models._acompletion_with_retry.<locals>._completion_with_retry_inner in 4.0 seconds as it raised InvalidArgument: 400 Request contains an invalid argument..
2025-03-21 16:12:16 WARNING Retrying langchain_google_vertexai.chat_models._acompletion_with_retry.<locals>._completion_with_retry_inner in 8.0 seconds as it raised InvalidArgument: 400 Request contains an invalid argument..
2025-03-21 16:12:24 WARNING Retrying langchain_google_vertexai.chat_models._acompletion_with_retry.<locals>._completion_with_retry_inner in 10.0 seconds as it raised InvalidArgument: 400 Request contains an invalid argument..
Traceback (most recent call last):
File "/home/khteh/.local/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py", line 77, in wait_for_connection
await self._call.wait_for_connection()
File "/home/khteh/.local/lib/python3.12/site-packages/grpc/aio/_call.py", line 659, in wait_for_connection
await self._raise_for_status()
File "/home/khteh/.local/lib/python3.12/site-packages/grpc/aio/_call.py", line 272, in _raise_for_status
raise _create_rpc_error(
grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:
status = StatusCode.INVALID_ARGUMENT
details = "Request contains an invalid argument."
debug_error_string = "UNKNOWN:Error received from peer ipv4:74.125.68.95:443 {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2025-03-21T16:12:34.945102813+08:00"}"
>
Code snippet in question:
async for event in agent.astream(
#{"messages": [{"role": "user", "content": messages}]},
{"messages": [("user", messages)]},
stream_mode="values",
config=config, # This is needed by Checkpointer
):
event["messages"][-1].pretty_print()