Alpha Notice: These docs cover the v1-alpha release. Content is incomplete and subject to change.For the latest stable version, see the current LangGraph Python or LangGraph JavaScript docs.
A LangGraph StateGraph
received a non-object return type from a node. Here’s an example:
Copy
Ask AI
import { z } from "zod";import { StateGraph } from "@langchain/langgraph";const State = z.object({ someKey: z.string(),});const badNode = (state: z.infer<typeof State>) => { // Should return an object with a value for "someKey", not an array return ["whoops"];};const builder = new StateGraph(State).addNode("badNode", badNode);// ...const graph = builder.compile();
Invoking the above graph will result in an error like this: