Skip to content

GenerateContentRequest.contents[3].parts: contents.parts must not be empty. #30408

Open
@Chandigarh-coder

Description

@Chandigarh-coder

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

import asyncio
import nest_asyncio

nest_asyncio.apply()  # Allows nested event loops

async def test(user_input):
    # Simulate asynchronous streaming of events
    async for event in graph.astream(
        {"messages": [("user", user_input)]},
        config={"configurable": {"thread_id": 42}},
    ):
        print(event)

async def main():
    while True:
        try:
            user_input = input("User: ")
            if user_input.lower() in ["quit", "exit", "q"]:
                print("Goodbye!")
                break

            # Call the async function using `await`
            await test(user_input)
        except Exception as e:
            print(f"Error: {str(e)}")
            # Fallback behavior
            user_input = "What do you know about LangGraph?"
            print("User: " + user_input)
            break

# Run the main coroutine
await main()

Error Message and Stack Trace (if applicable)

Error: Invalid argument provided to Gemini: 400 * GenerateContentRequest.contents[3].parts: contents.parts must not be empty.

Description

LangGraph (1).pdf

System Info

Package Version


aiohappyeyeballs 2.4.4
aiohttp 3.11.10
aiosignal 1.3.1
annotated-types 0.7.0
anthropic 0.42.0
anyio 4.7.0
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.3.0
asttokens 3.0.0
async-lru 2.0.4
async-timeout 4.0.3
attrs 24.2.0
babel 2.16.0
beautifulsoup4 4.12.3
bleach 6.2.0
blinker 1.9.0
cachetools 5.5.2
certifi 2024.8.30
cffi 1.17.1
charset-normalizer 3.4.0
click 8.1.8
comm 0.2.2
dataclasses-json 0.6.7
datasets 3.2.0
debugpy 1.8.9
decorator 5.1.1
defusedxml 0.7.1
dill 0.3.8
distro 1.9.0
exceptiongroup 1.2.2
executing 2.1.0
fastapi 0.115.8
fastjsonschema 2.21.1
filelock 3.17.0
filetype 1.2.0
Flask 3.1.0
fqdn 1.5.1
frozendict 2.4.6
frozenlist 1.5.0
fsspec 2024.9.0
google 3.0.0
google-ai-generativelanguage 0.6.17
google-api-core 2.24.2
google-api-python-client 2.164.0
google-auth 2.38.0
google-auth-httplib2 0.2.0
google-generativeai 0.8.4
googleapis-common-protos 1.69.2
greenlet 3.1.1
groq 0.13.0
grpcio 1.71.0
grpcio-status 1.71.0
h11 0.14.0
httpcore 1.0.7
httplib2 0.22.0
httpx 0.28.1
httpx-sse 0.4.0
huggingface-hub 0.27.1
idna 3.10
ipykernel 6.29.5
ipython 8.30.0
isoduration 20.11.0
itsdangerous 2.2.0
jedi 0.19.2
Jinja2 3.1.4
jiter 0.8.2
joblib 1.4.2
json5 0.10.0
jsonpatch 1.33
jsonpointer 3.0.0
jsonschema 4.23.0
jsonschema-specifications 2024.10.1
jupyter_client 8.6.3
jupyter_core 5.7.2
jupyter-events 0.10.0
jupyter-lsp 2.2.5
jupyter_server 2.14.2
jupyter_server_terminals 0.5.3
jupyterlab 4.3.2
jupyterlab_pygments 0.3.0
jupyterlab_server 2.27.3
langchain 0.3.14
langchain-anthropic 0.3.4
langchain-community 0.3.14
langchain-core 0.3.44
langchain-experimental 0.3.4
langchain-google-genai 2.1.0
langchain-groq 0.2.2
langchain-ollama 0.2.3
langchain-openai 0.3.0
langchain-text-splitters 0.3.3
langchainhub 0.1.21
langgraph 0.3.1
langgraph-checkpoint 2.0.10
langgraph-prebuilt 0.1.3
langgraph-sdk 0.1.43
langserve 0.3.1
langsmith 0.1.147
lxml 5.3.1
MarkupSafe 3.0.2
marshmallow 3.23.1
matplotlib-inline 0.1.7
mistune 3.0.2
msgpack 1.1.0
multidict 6.1.0
multiprocess 0.70.16
multitasking 0.0.11
mypy-extensions 1.0.0
nbclient 0.10.1
nbconvert 7.16.4
nbformat 5.10.4
nest-asyncio 1.6.0
networkx 3.4.2
nltk 3.9.1
notebook 7.3.1
notebook_shim 0.2.4
numpy 1.26.4
ollama 0.4.7
openai 1.58.1
orjson 3.10.12
outcome 1.3.0.post0
overrides 7.7.0
packaging 24.2
pandas 2.2.3
pandocfilters 1.5.1
parso 0.8.4
peewee 3.17.9
pexpect 4.9.0
pip 24.2
platformdirs 4.3.6
prometheus_client 0.21.1
prompt_toolkit 3.0.48
propcache 0.2.1
proto-plus 1.26.1
protobuf 5.29.3
psutil 6.1.0
ptyprocess 0.7.0
pure_eval 0.2.3
pyarrow 19.0.0
pyasn1 0.6.1
pyasn1_modules 0.4.1
pycparser 2.22
pydantic 2.9.2
pydantic_core 2.23.4
pydantic-settings 2.6.1
Pygments 2.18.0
pyparsing 3.2.1
PySocks 1.7.1
python-dateutil 2.9.0.post0
python-dotenv 1.0.1
python-json-logger 2.0.7
pytz 2024.2
PyYAML 6.0.2
pyzmq 26.2.0
redis 5.2.1
referencing 0.35.1
regex 2024.11.6
requests 2.32.3
requests-toolbelt 1.0.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.22.3
rsa 4.9
selenium 4.28.1
Send2Trash 1.8.3
setuptools 75.1.0
six 1.17.0
sniffio 1.3.1
snscrape 0.7.0.20230622
sortedcontainers 2.4.0
soupsieve 2.6
SQLAlchemy 2.0.36
stack-data 0.6.3
starlette 0.45.3
tavily-python 0.5.0
tenacity 8.5.0
terminado 0.18.1
tiktoken 0.8.0
tinycss2 1.4.0
tomli 2.2.1
tornado 6.4.2
tqdm 4.67.1
traitlets 5.14.3
trio 0.28.0
trio-websocket 0.11.1
types-python-dateutil 2.9.0.20241206
types-requests 2.32.0.20241016
typing_extensions 4.12.2
typing-inspect 0.9.0
tzdata 2024.2
uri-template 1.3.0
uritemplate 4.1.1
urllib3 2.2.3
uv 0.5.9
wcwidth 0.2.13
webcolors 24.11.1
webencodings 0.5.1
websocket-client 1.8.0
Werkzeug 3.1.3
wheel 0.44.0
wsproto 1.2.0
xxhash 3.5.0
yarl 1.18.3
yfinance 0.2.54

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤖:bugRelated to a bug, vulnerability, unexpected error with an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions