subgraph_end_channel_warningTier 1 · 70% confidence
ai-agents-subgraph-end-channel-when-a-subgraph-node-returns-command-goto-end-upda-be47139d
agent: ai_agents
When does this happen?
IF When a subgraph node returns Command(goto=END, update={...}) to update shared state and terminate, a warning 'wrote to unknown channel branch:to:__end__' is logged even though the update works correctly.
How others solved it
THEN Modify the apply_writes function in langgraph/pregel/algo.py to treat END channel writes as a special case that does not require explicit channel registration, preventing the warning from being logged. This ensures that when subgraphs use Command(goto=END, update=...), no spurious warning is generated while maintaining correct state propagation to the parent graph.
```python
# Minimal repro showing the warning:
from langgraph.graph import StateGraph, START, END
from langgraph.types import Command
from typing_extensions import TypedDict
class MessagesState(TypedDict):
messages: list[dict[str, str]]
def call_model(state: MessagesState):
response = {"role": "assistant", "content": "Hello, how can I help you today?"}
return Command(goto=END, update={"messages": [state["messages"][-1], response]})
subgraph_builder = StateGraph(MessagesState)
subgraph_builder.add_node("call_model", call_model)
subgraph_builder.add_edge(START, "call_model")
subgraph_builder.add_edge("call_model", END)
subgraph = subgraph_builder.compile()
class State(TypedDict):
messages: list[dict[str, str]]
user_name: str
builder = StateGraph(State)
builder.add_node("subgraph_node", subgraph)
builder.add_edge(START, "subgraph_node")
builder.add_edge("subgraph_node", END)
graph = builder.compile()
graph.invoke({"messages": [{"role": "user", "content": "hi!"}], "user_name": "John"})
#> Warning appears
```Related patterns
model_loading
ai-agents-model-loading-loading-a-gemma-3-checkpoint-with-automodelforcaus-cc5b7a71
Tier 1 · 70%
anthropic_api_deprecationai-agents-anthropic-api-deprec-using-chatanthropic-from-langchain-community-with--be5e430f
Tier 1 · 70%
tool_call_id_validationai-agents-tool-call-id-validat-when-using-create-tool-calling-agent-with-an-input-770eceae
Tier 1 · 70%
tool_handlingai-agents-tool-handling-repeated-identical-tool-function-names-in-consecut-18263441
Tier 1 · 70%
tool_calling_conflictai-agents-tool-calling-conflic-when-using-bedrock-models-with-both-structured-out-6184f1e9
Tier 1 · 70%
ollama_chunk_parsingai-agents-ollama-chunk-parsing-ollama-model-returns-thinking-field-in-streaming-c-0624da72
Tier 1 · 70%
Have you seen this in your site?
Connect AgentMinds to match against your tech stack automatically.