langchain-ai/langgraph · error · ValueError

Invalid write entry

Error message

Invalid write entry: {w}

What it means

Raised by _get_writes when a write entry is of an unrecognized type — neither Send, ChannelWriteTupleEntry, nor ChannelWriteEntry. The assembler names the offending entry; usually caused by custom write objects injected into the write pipeline.

Solutions

  1. Use only ChannelWriteEntry / ChannelWriteTupleEntry / Send objects in writes
  2. Convert custom entries to one of the supported types before assembly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/langgraph/langgraph/pregel/_write.py:191 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/4bd9a666e68c5227. Report an issue: GitHub.

Appendix: source

Thrown at libs/langgraph/langgraph/pregel/_write.py:191

    writes: Sequence[ChannelWriteEntry | ChannelWriteTupleEntry | Send],
) -> list[tuple[str, Any]]:
    """Assembles the writes into a list of tuples."""
    tuples: list[tuple[str, Any]] = []
    for w in writes:
        if isinstance(w, Send):
            tuples.append((TASKS, w))
        elif isinstance(w, ChannelWriteTupleEntry):
            if ww := w.mapper(w.value):
                tuples.extend(ww)
        elif isinstance(w, ChannelWriteEntry):
            value = w.mapper(w.value) if w.mapper is not None else w.value
            if value is SKIP_WRITE:
                continue
            if w.skip_none and value is None:
                continue
            tuples.append((w.channel, value))
        else:
            raise ValueError(f"Invalid write entry: {w}")
    return tuples

View on GitHub (pinned to 38031739e5)