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: