langchain-ai/langchain

core: `missing_required_parameter` when using LangGraph to pass multimodal data to models

Closed

#31,505 opened on Jun 5, 2025

 (18 comments) (2 reactions) (1 assignee)Python (22,617 forks)batch import
coreexternalhelp wantedinvestigate

Repository metrics

Stars
 (136,758 stars)
PR merge metrics
 (Avg merge 10d 2h) (288 merged PRs in 30d)

Description

Checked other resources

  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Example Code

Hi all,

 messages = prompt + state["messages"]
 chat = ChatPromptTemplate.from_messages(messages)
logger.debug("-------------------------------------------------------------------------------->> invoking LLM with config")
logger.debug(f"{chat}")
logger.debug("-------------------------------------------------------------------------------->> invoking LLM...")
response = await model.ainvoke(chat.format_prompt(), config)

Error Message and Stack Trace (if applicable)

this outputs:

== APP == -------------------------------------------------------------------------------->> invoking LLM with config
== APP == input_variables=[] input_types={} partial_variables={} messages=[SystemMessage(content="You are a concierge agent. You are very helpful and friendly. You are very polite and respectful. You are always ready to help.\n\ncurrent date/time: 2025-06-05 19:32:40\n\nuser context: {'id': '123123123', 'name': 'Bruno Figueiredo', 'avatar': ''}", additional_kwargs={}, response_metadata={}), HumanMessage(content='olá', additional_kwargs={}, response_metadata={}, id='8fa5db18-69b0-4085-9d4e-aa16847da243'), AIMessage(content='Olá, Bruno! 😊 Como posso ajudar você hoje?', additional_kwargs={}, response_metadata={'finish_reason': 'stop', 'model_name': 'gpt-4o-2024-11-20', 'system_fingerprint': 'fp_ee1d74bde0'}, id='run-2df83ba9-a843-4029-a020-0d41465fddf3'), HumanMessage(content=[{'type': 'text', 'text': 'resume'}, {'type': 'file', 'source_type': 'url', 'url': 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'}], additional_kwargs={}, response_metadata={}, id='363b871a-d9bc-4f40-ab56-5138486e7f07')]
== APP == -------------------------------------------------------------------------------->> invoking LLM...
== APP == Error invoking model: Error code: 400 - {'error': {'message': "Missing required parameter: 'messages[3].content[1].file'.", 'type': 'invalid_request_error', 'param': 'messages[3].content[1].file', 'code': 'missing_required_parameter'}}

Description

Hi all,

I have a langgraph agent with several nodes and I'm calling the graph via agent.astream_events(**kwargs, version="v2").

Tested with GPT4o and gemini-1.5-flash

If I use an image the code works well

HumanMessage(
                    content=[
                        {"type": "text", "text": user_input.message},
                        {
                            "type": "image_url",
                            "image_url": {
                                "url": f"data:{user_input.file_type};base64,{user_input.file}"
                            },
                        }
                    ]
                )

but if I use a file I get the error above

 HumanMessage(
                        content=[
                            {"type": "text", "text": user_input.message},
                            {
                                "type": "file",
                                "source_type": "url",
                                "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
                            },
                        ]
                    )

Any thoughs? thanks

System Info

== APP == == APP == System Information == APP == ------------------ == APP == > OS: Linux == APP == > OS Version: #1 SMP PREEMPT_DYNAMIC Mon Apr 21 17:08:54 UTC 2025 == APP == > Python Version: 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0] == APP == == APP == Package Information == APP == ------------------- == APP == > langchain_core: 0.3.48 == APP == > langchain: 0.3.15 == APP == > langchain_community: 0.3.15 == APP == > langsmith: 0.2.11 == APP == > langchain_chroma: 0.1.4 == APP == > langchain_google_genai: 2.1.1 == APP == > langchain_groq: 0.3.1 == APP == > langchain_mcp_adapters: 0.0.5 == APP == > langchain_ollama: 0.3.0 == APP == > langchain_openai: 0.2.14 == APP == > langchain_postgres: 0.0.13 == APP == > langchain_text_splitters: 0.3.5 == APP == > langgraph_sdk: 0.1.51 == APP == == APP == Optional packages not installed == APP == ------------------------------- == APP == > langserve == APP == == APP == Other Dependencies == APP == ------------------ == APP == > aiohttp: 3.11.11 == APP == > async-timeout: Installed. No version info available. == APP == > chromadb: 0.5.0 == APP == > dataclasses-json: 0.6.7 == APP == > fastapi: 0.115.6 == APP == > filetype: 1.2.0 == APP == > google-ai-generativelanguage: 0.6.17 == APP == > groq<1,>=0.4.1: Installed. No version info available. == APP == > httpx: 0.28.1 == APP == > httpx-sse: 0.4.0 == APP == > jsonpatch<2.0,>=1.33: Installed. No version info available. == APP == > langchain-core<0.4,>=0.3.36: Installed. No version info available. == APP == > langchain-core<1.0.0,>=0.3.47: Installed. No version info available. == APP == > langsmith-pyo3: Installed. No version info available. == APP == > langsmith<0.4,>=0.1.125: Installed. No version info available. == APP == > mcp<1.5,>=1.4.1: Installed. No version info available. == APP == > numpy: 1.26.4 == APP == > ollama<1,>=0.4.4: Installed. No version info available. == APP == > openai: 1.59.9 == APP == > orjson: 3.10.15 == APP == > packaging<25,>=23.2: Installed. No version info available. == APP == > pgvector: 0.2.5 == APP == > psycopg: 3.2.6 == APP == > psycopg-pool: 3.2.6 == APP == > pydantic: 2.10.5 == APP == > pydantic-settings: 2.7.1 == APP == > pydantic<3.0.0,>=2.5.2;: Installed. No version info available. == APP == > pydantic<3.0.0,>=2.7.4;: Installed. No version info available. == APP == > PyYAML: 6.0.2 == APP == > PyYAML>=5.3: Installed. No version info available. == APP == > requests: 2.32.3 == APP == > requests-toolbelt: 1.0.0 == APP == > SQLAlchemy: 2.0.37 == APP == > sqlalchemy: 2.0.37 == APP == > tenacity: 9.0.0 == APP == > tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available. == APP == > tiktoken: 0.8.0 == APP == > typing-extensions>=4.7: Installed. No version info available. == APP == > zstandard: Installed. No version info available.

Contributor guide