langchain-ai/langgraph · error · InvalidUpdateError
Cannot write to the reserved channel TASKS
Error message
Cannot write to the reserved channel TASKS
What it means
Raised by ChannelWrite.do_write when a write entry targets the reserved TASKS channel. TASKS is managed internally by the pregel engine to schedule Send tasks; user code writing to it would corrupt task scheduling. Write to your own channels instead.
Solutions
- Write to a regular state key instead
- Use Send(...) via Command to schedule tasks rather than writing TASKS yourself
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at libs/langgraph/langgraph/pregel/_write.py:115 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of langchain-ai/langgraph@38031739e5 (2026-08-26).
Data as JSON: /api/errors/d2ae02935d41a50a.
Report an issue: GitHub.
Appendix: source
Thrown at libs/langgraph/langgraph/pregel/_write.py:115
for write in self.writes
]
self.do_write(
config,
writes,
)
return input
@staticmethod
def do_write(
config: RunnableConfig,
writes: Sequence[ChannelWriteEntry | ChannelWriteTupleEntry | Send],
allow_passthrough: bool = True,
) -> None:
# validate
for w in writes:
if isinstance(w, ChannelWriteEntry):
if w.channel == TASKS:
raise InvalidUpdateError(
"Cannot write to the reserved channel TASKS"
)
if w.value is PASSTHROUGH and not allow_passthrough:
raise InvalidUpdateError("PASSTHROUGH value must be replaced")
if isinstance(w, ChannelWriteTupleEntry):
if w.value is PASSTHROUGH and not allow_passthrough:
raise InvalidUpdateError("PASSTHROUGH value must be replaced")
# if we want to persist writes found before hitting a ParentCommand
# can move this to a finally block
write: TYPE_SEND = config[CONF][CONFIG_KEY_SEND]
write(_assemble_writes(writes))
@staticmethod
def is_writer(runnable: Runnable) -> bool:
"""Used by PregelNode to distinguish between writers and other runnables."""
return (
isinstance(runnable, ChannelWrite)
or getattr(runnable, "_is_channel_writer", MISSING) is not MISSINGView on GitHub (pinned to 38031739e5)