CLI: `langgraph build` fails when a local dependency ships its own requirements.txt
Checked other resources
- This is a bug, not a usage question.
- I added a clear and descriptive title that summarizes 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 LangGraph rather than my code.
- The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).
- This is not related to the langchain-community package.
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Related Issues / PRs
#3832 is the Windows half of this. It was closed in June 2025 but still reproduces on 0.4.32, so I'm opening a new issue as suggested there (cc @sydney-runkle). The Windows path was fixed once in #3101 and lost in 4623f7b5 when the line moved.
Reproduction Steps / Example Code (Python)
Both cases are in the "Installing local requirements" block of the generated Dockerfile.
1. Local dependency outside the config directory (any OS)
mkdir -p shared proj && touch shared/__init__.py
echo httpx > shared/requirements.txt
echo "graph = None" > proj/agent.py
echo '{"dependencies": [".", "../shared"], "graphs": {"agent": "./agent.py:graph"}}' > proj/langgraph.json
cd proj && langgraph dockerfile Dockerfile && grep -- "--from" Dockerfile Run docker build with these additional build contexts `--build-context outer-shared=/tmp/shared`
COPY --from=outer-requirements.txt requirements.txt /deps/outer-shared/shared/requirements.txt
COPY --from=outer-shared . /deps/outer-shared/sharedThe requirements line uses the file name as the context (outer-requirements.txt) instead of the dependency's context (outer-shared), so the build fails even with the suggested --build-context.
2. A subdirectory dependency with its own requirements.txt, on Windows
Same layout as langgraph-example: my_agent/requirements.txt and "dependencies": ["./my_agent"]. Running langgraph dockerfile Dockerfile on Windows generates:
ADD my_agent\requirements.txt /deps/outer-my_agent/my_agent/requirements.txt\ is Docker's escape character, so it looks for my_agentrequirements.txt.
Error Message and Stack Trace (if applicable)
Case 1:
ERROR: failed to solve: outer-requirements.txt: failed to resolve source metadata for docker.io/library/outer-requirements.txt:latest: pull access denied, repository does not exist or may require authorizationCase 2:
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref ...: "/my_agentrequirements.txt": not foundDescription
Both come from these lines in python_config_to_docker (libs/cli/langgraph_cli/config.py):
f"COPY --from=outer-{reqpath.name} requirements.txt {destpath}" # reqpath.name is "requirements.txt"
if reqpath.parent in local_deps.additional_contexts
else f"ADD {reqpath.relative_to(config_path.parent)} {destpath}" # backslashes on WindowsThe context is registered as outer-{dir name}, so it should be reqpath.parent.name, and the ADD source needs .as_posix(). test_config_to_docker_simple currently expects the outer-requirements.txt line, which is why this wasn't caught.
I have a fix with regression tests ready. Could a maintainer assign this to me?
System Info
- langgraph-cli 0.4.32 (latest) and
main@ 07b33185 - Case 1: Linux (python:3.12 container) and Windows 11
- Case 2: Windows 11, Python 3.14.7
- Docker 28.3.2
Source: langchain-ai/langgraph