Skip to main content
LangGraph StateGraph가 노드로부터 객체가 아닌 반환 타입을 받았습니다. 다음은 예시입니다:
import * as z from "zod";
import { StateGraph } from "@langchain/langgraph";

const State = z.object({
  someKey: z.string(),
});

const badNode = (state: z.infer<typeof State>) => {
  // "someKey"에 대한 값을 포함하는 객체를 반환해야 하는데, 배열을 반환했습니다
  return ["whoops"];
};

const builder = new StateGraph(State).addNode("badNode", badNode);
// ...

const graph = builder.compile();
위 그래프를 호출하면 다음과 같은 오류가 발생합니다:
await graph.invoke({ someKey: "someval" });
InvalidUpdateError: Expected object, got ['whoops']
For troubleshooting, visit: https://langchain-ai.github.io/langgraphjs/troubleshooting/errors/INVALID_GRAPH_NODE_RETURN_VALUE
그래프의 노드는 상태에 정의된 하나 이상의 키를 포함하는 객체를 반환해야 합니다.

문제 해결

다음 사항이 이 오류를 해결하는 데 도움이 될 수 있습니다:
  • 노드에 복잡한 로직이 있는 경우, 모든 코드 경로가 정의된 상태에 적합한 객체를 반환하는지 확인하세요.

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I