Error with import content from langchain_core.message with LangChain V1

Iam using langchain V1, and i got this error:
```
File “/home/mhkone/AI Progress/Lang_Ecosystem/.venv/lib/python3.12/site-packages/langchain_openai/chat_models/base.py”, line 60, in
from langchain_core.messages import content as types
ImportError: cannot import name ‘content’ from ‘langchain_core.messages’ (/home/mhkone/AI Progress/Lang_Ecosystem/.venv/lib/python3.12/site-packages/langchain_core/messages/init.py)
Could not import python module for graph:
GraphSpec(id=‘agent’, path=‘./src/deep_research_from_scratch/research_agent_scope.py’, module=None, variable=‘scope_research’, config={}, description=None)
This error likely means you haven’t installed your project and its dependencies yet. Before running the server, install your project:

If you are using requirements.txt:
python -m pip install -r requirements.txt

If you are using pyproject.toml or setuptools:
python -m pip install -e .

Make sure to run this command from your project’s root directory (where your setup.py or pyproject.toml is located)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/home/mhkone/AI Progress/Lang_Ecosystem/.venv/lib/python3.12/site-packages/starlette/routing.py”, line 694, in lifespan
async with self.lifespan_context(app) as maybe_state:
File “/usr/local/lib/python3.12/contextlib.py”, line 210, in aenter
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File “/home/mhkone/AI Progress/Lang_Ecosystem/.venv/lib/python3.12/site-packages/langgraph_runtime_inmem/lifespan.py”, line 80, in lifespan
await graph.collect_graphs_from_env(True)
File “/home/mhkone/AI Progress/Lang_Ecosystem/.venv/lib/python3.12/site-packages/langgraph_api/graph.py”, line 422, in collect_graphs_from_env
raise GraphLoadError(spec, exc) from exc
langgraph_api.utils.errors.GraphLoadError: Failed to load graph ‘agent’ from ./src/deep_research_from_scratch/research_agent_scope.py: cannot import name ‘content’ from ‘langchain_core.messages’ (/home/mhkone/AI Progress/Lang_Ecosystem/.venv/lib/python3.12/site-packages/langchain_core/messages/init.py)
[uvicorn.error] api_variant=local_dev langgraph_api_version=0.4.44 thread_name=MainThread
2025-10-28T03:11:39.156579Z [error ] Application startup failed. Exiting. [uvicorn.error] api_variant=local_dev langgraph_api_version=0.4.44 thread_name=MainThread
```

hi @MHKone

there is likely version mismatch between langchain-openai and langchain-core causing from langchain_core.messages import content to fail; GraphLoadError is a cascade.

Which one do you have in your project: pyproject.toml or requirements.txt?

  1. Upgrade and align langchain, langchain-core, langchain-openai in requirements.txt or pyproject.tom
  2. Reinstall your project (pip install -r requirements.txt or pip install -e .)
1 Like