`langgraph up` with syntax errors creates dangling Docker images (and eats up available disk)
Checked other resources
- [X] I added a very descriptive title to this issue.
- [X] I searched the LangGraph/LangChain documentation with the integrated search.
- [X] I used the GitHub search to find a similar question and didn't find it.
- [X] I am sure that this is a bug in LangGraph/LangChain rather than my code.
- [X] I am sure this is better as an issue rather than a GitHub discussion, since this is a LangGraph bug and not a design question.
Example Code
from typing import Any, Dict, List, Optional
from pydantic import BaseModel
from langgraph.graph import StateGraph, START, END
class State(BaseModel):
string_default: Optional[str] = None
int_default: Optional[int] = None
float_default: Optional[float] = None
dict_default: Optional[Dict[str, Any]] = None
list_default: Optional[List[str]] = None
def node(state: State):
return {
'string_default': state.string_default,
'int_default': state.int_default,
'float_default': state.float_default,
'dict_default': state.dict_default,
'list_default': state.list_default,
}
graph_builder = StateGraph(State)
graph_builder.add_node("default", node)
graph_builder.add_edge(START, "syntax_error")
graph_builder.add_edge("default", END)
graph = graph_builder.compile()
Error Message and Stack Trace (if applicable)
Doing this enough times will result in Docker errors like:
failed to solve: failed to copy files: userspace copy failed: write /var/lib/docker/overlay2/f89z6c11ya4bjzmal3lonj3tk/merged/deps/[repo]/.env.dev: no space left on device
Description
Initial state
> docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 0 0 0B 0B
Containers 0 0 0B 0B
Local Volumes 0 0 0B 0B
Build Cache 0 0 0B 0B
Amend graph code to have one syntax error and langgraph up
> docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 3 2 1.042GB 257.3MB (24%)
Containers 2 0 5.002MB 5.002MB (100%)
Local Volumes 1 1 40.85MB 0B (0%)
Build Cache 21 0 98.84MB 98.84MB
Amend graph code to have a different syntax error and langgraph
> docker system df
docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 4 2 1.143GB 685.5MB (59%)
Containers 2 0 5.002MB 5.002MB (100%)
Local Volumes 1 1 40.85MB 0B (0%)
Build Cache 25 0 98.84MB 98.84MB
Doing a verbose df reveals that dangling images are not being cleaned up:
docker system df --verbose
Images space usage:
REPOSITORY TAG IMAGE ID CREATED SIZE SHARED SIZE UNIQUE SIZE CONTAINERS
ewalker-langgraph-langgraph-api latest ad138f07385a 4 minutes ago 686MB 584.1MB 101.4MB 1
<none> <none> bfe00bd0a94c 4 minutes ago 686MB 584.1MB 101.4MB 0
<none> <none> 46d4c46c4981 6 minutes ago 686MB 584.1MB 101.4MB 0
langchain/langgraph-api 3.11 799a89355392 17 hours ago 257MB 257.3MB 0B 0
postgres 16 35042a754d27 6 days ago 453MB 97.11MB 356.3MB 1
...
System Info
System Information
OS: Darwin OS Version: Darwin Kernel Version 23.5.0: Wed May 1 20:17:33 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6031 Python Version: 3.12.3 (main, May 28 2024, 11:22:04) [Clang 15.0.0 (clang-1500.3.9.4)]
Package Information
langchain_core: 0.2.28 langchain: 0.2.12 langchain_community: 0.2.11 langsmith: 0.1.96 langchain_anthropic: 0.1.22 langchain_openai: 0.1.20 langchain_text_splitters: 0.2.2 langgraph: 0.2.2
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
langserve
hi @ewalker11 can you run this code standalone I think the default node is unreachable here also syntax_error node is defined anywhere
Closing due to inactivity. Please use langgraph dev for running a local LangGraph API server https://langchain-ai.github.io/langgraph/tutorials/langgraph-platform/local-server/