-
Notifications
You must be signed in to change notification settings - Fork 234
ChatVertexAI InvalidArgument Error (Missing Parts Field) with Large Context in System Message (Gemini 2.5 Flash Preview Model) #903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Here is the full error message: `InvalidArgument('Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini')Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 76, in error_remapped_callable File "/layers/google.python.pip/pip/lib/python3.11/site-packages/grpc/_channel.py", line 1181, in call File "/layers/google.python.pip/pip/lib/python3.11/site-packages/grpc/_channel.py", line 1006, in _end_unary_response_blocking grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langgraph/pregel/init.py", line 1298, in stream File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langgraph/pregel/runner.py", line 56, in tick File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langgraph/pregel/retry.py", line 29, in run_with_retry File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langgraph/utils/runnable.py", line 409, in invoke File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langgraph/utils/runnable.py", line 183, in invoke File "/workspace/main.py", line 1679, in call_model File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 284, in invoke File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 784, in generate_prompt File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 641, in generate File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 631, in generate File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 850, in _generate_with_cache File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_google_vertexai/chat_models.py", line 1174, in _generate File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_google_vertexai/chat_models.py", line 1331, in _generate_gemini File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_google_vertexai/chat_models.py", line 612, in _completion_with_retry File "/layers/google.python.pip/pip/lib/python3.11/site-packages/tenacity/init.py", line 336, in wrapped_f File "/layers/google.python.pip/pip/lib/python3.11/site-packages/tenacity/init.py", line 475, in call File "/layers/google.python.pip/pip/lib/python3.11/site-packages/tenacity/init.py", line 376, in iter File "/layers/google.python.pip/pip/lib/python3.11/site-packages/tenacity/init.py", line 418, in exc_check File "/layers/google.python.pip/pip/lib/python3.11/site-packages/tenacity/init.py", line 185, in reraise File "/layers/google.python.runtime/python/lib/python3.11/concurrent/futures/_base.py", line 449, in result File "/layers/google.python.runtime/python/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result File "/layers/google.python.pip/pip/lib/python3.11/site-packages/tenacity/init.py", line 478, in call File "/layers/google.python.pip/pip/lib/python3.11/site-packages/langchain_google_vertexai/chat_models.py", line 605, in _completion_with_retry_inner File "/layers/google.python.pip/pip/lib/python3.11/site-packages/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py", line 2280, in generate_content File "/layers/google.python.pip/pip/lib/python3.11/site-packages/google/api_core/gapic_v1/method.py", line 131, in call File "/layers/google.python.pip/pip/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 78, in error_remapped_callable google.api_core.exceptions.InvalidArgument: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini` |
We are sending JSON-data from our text extraction process in a SystemMessage and getting this error:
Here is the error message:
WARNING:langchain_google_vertexai._retry:Retrying langchain_google_vertexai.chat_models._completion_with_retry.._completion_with_retry_inner in 4.0 seconds as it raised InvalidArgument: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini.
WARNING:langchain_google_vertexai._retry:Retrying langchain_google_vertexai.chat_models._completion_with_retry.._completion_with_retry_inner in 4.0 seconds as it raised InvalidArgument: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini.
WARNING:langchain_google_vertexai._retry:Retrying langchain_google_vertexai.chat_models._completion_with_retry.._completion_with_retry_inner in 4.0 seconds as it raised InvalidArgument: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini.
WARNING:langchain_google_vertexai._retry:Retrying langchain_google_vertexai.chat_models._completion_with_retry.._completion_with_retry_inner in 8.0 seconds as it raised InvalidArgument: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini.
WARNING:langchain_google_vertexai._retry:Retrying langchain_google_vertexai.chat_models._completion_with_retry.._completion_with_retry_inner in 10.0 seconds as it raised InvalidArgument: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini.
ERROR:main:Error processing request: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini
Environment:
Framework: LangChain (using LangGraph StateGraph with MessagesState)
Model Integration: langchain_google_vertexai.ChatVertexAI
Model Name: Primarily failing with gemini-2.5-flash-preview-04-17.
Platform: Flask application running on Google Cloud, using Firestore for chat history and GCS for document context storage.
LangChain Libraries:
langchain==0.3.24
langchain-community==0.3.1
langchain-core==0.3.56
langchain-google-vertexai==2.0.21
langchain-openai==0.2.2
langchain-pinecone==0.2.0
langchain-text-splitters==0.3.8
langgraph==0.2.34
langgraph-checkpoint==2.0.0
langsmith==0.1.131
Python Version: 3.9.22
Application Goal & Workflow:
- google.api_core.exceptions.InvalidArgument: 400 Unable to submit request because it must include at least one parts field, which describes the prompt input. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini
I have updated to the recent chatvertextai, langchain-core and langchain version.
Debugging steps taken:
Current Hypothesis:
The text was updated successfully, but these errors were encountered: