Node types not working when graph config provided #378

Open
opened 2026-02-15 18:16:20 -05:00 by yindo · 2 comments
Owner

Originally created by @adm-robinweston on GitHub (Nov 9, 2025).

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangGraph.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).

Example Code


import { START, END, StateGraph, interrupt } from '@langchain/langgraph';
import z from 'zod/v4';

const OverallState = z.object({
  foo: z.string(),
  bar: z.string(),
});

const interupts = {
  doInterrupt: interrupt<number, string>,
};

const builder = new StateGraph(OverallState, { interrupt: interupts });

type NodeType = typeof builder.Node;

const node1: NodeType = async (state, _runtime) => {
  return { foo: state.bar + ' name' };
};

const node2: NodeType = async (state, runtime) => {
  runtime.interrupt.doInterrupt(1);
  return { bar: state.foo + ' is' };
};

const graph = builder
  .addNode('node1', node1)
  .addNode('node2', node2)
  .addEdge(START, 'node1')
  .addEdge('node1', 'node2')
  .addEdge('node2', END)
  .compile();

await graph.invoke({ foo: '', bar: 'My' });

Error Message and Stack Trace (if applicable)

No overload matches this call.
Overload 1 of 4, '(key: "node2", action: NodeAction<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>>, StateDefinition, unknown, unknown>, options?: StateGraphAddNodeOptions<...> | undefined): StateGraph<...>', gave the following error.
Argument of type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> | Command<...>, Runtime<...>>' is not assignable to parameter of type 'NodeAction<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>>, StateDefinition, unknown, unknown>'.
Type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> | Command<...>, Runtime<...>>' is not assignable to type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> & Record<...>, Runtime<...>>'.
Type 'Runtime<StateType, unknown, unknown>' is not assignable to type 'Runtime<StateType, { doInterrupt: (value: number) => string; }, unknown>'.
Types of property 'interrupt' are incompatible.
Type '(value: unknown) => unknown' is not assignable to type '{ doInterrupt: (value: number) => string; }'.
Overload 2 of 4, '(key: "node2", action: NodeAction<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>>, StateDefinition, unknown, unknown>, options?: StateGraphAddNodeOptions<...> | undefined): StateGraph<...>', gave the following error.
Argument of type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> | Command<...>, Runtime<...>>' is not assignable to parameter of type 'NodeAction<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>>, StateDefinition, unknown, unknown>'.
Type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> | Command<...>, Runtime<...>>' is not assignable to type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> & Record<...>, Runtime<...>>'.
Type 'Runtime<StateType, unknown, unknown>' is not assignable to type 'Runtime<StateType, { doInterrupt: (value: number) => string; }, unknown>'.
Types of property 'interrupt' are incompatible.
Type '(value: unknown) => unknown' is not assignable to type '{ doInterrupt: (value: number) => string; }'.

Description

When creating a simple graph with a state schema and a graph config, then any node not defined inline will fail with a type error.

This isn't caught in a langgraph unit test because the only test that adds nodes this way doesn't chain the calls and adds them separately. https://github.com/langchain-ai/langgraphjs/blob/18abe1e813e1631a03bad39e20e64099d18d48d7/libs/langgraph-core/src/tests/pregel.test-d.ts#L601

System Info

Node version: v22.19.0
Operating system: darwin arm64
Package manager: npm
Package manager version: N/A

@langchain/core -> @1.0.2, , @"^1.0.2", @"^1.0.1", @"^0.3.59, @"^1.0.0"
langsmith -> @0.3.71, , @"^0.3.64", @"^0.3.33"
zod -> @4.1.12, , @"^4.1.12", @"^4.1.11", @"^3.25, @"^3.25.76, @"^3.25.32, @3.23.8, @"3.23.8", @3.25.76, @"^3.19.1"
@langchain/langgraph-checkpoint-postgres -> @1.0.0, , @"^1.0.0"
@langchain/langgraph-checkpoint -> @1.0.0, , @"^1.0.0", @"~0.0.16
@langchain/langgraph-cli -> @1.0.3, , @"^1.0.3"
@langchain/langgraph-api -> @1.0.3, , @"1.0.3"
@langchain/langgraph-sdk -> @1.0.0, , @"~1.0.0", @"~0.0.16
@langchain/langgraph-ui -> @1.0.3, , @"1.0.3"
@langchain/langgraph -> @1.0.1, , @"^1.0.1", @"^0.2.57
@langchain/openai -> @1.0.0, , @"^1.0.0"

Originally created by @adm-robinweston on GitHub (Nov 9, 2025). ### Checked other resources - [x] I added a very descriptive title to this issue. - [x] I searched the LangGraph.js documentation with the integrated search. - [x] I used the GitHub search to find a similar question and didn't find it. - [x] I am sure that this is a bug in LangGraph.js rather than my code. - [x] The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package). ### Example Code ```typescript import { START, END, StateGraph, interrupt } from '@langchain/langgraph'; import z from 'zod/v4'; const OverallState = z.object({ foo: z.string(), bar: z.string(), }); const interupts = { doInterrupt: interrupt<number, string>, }; const builder = new StateGraph(OverallState, { interrupt: interupts }); type NodeType = typeof builder.Node; const node1: NodeType = async (state, _runtime) => { return { foo: state.bar + ' name' }; }; const node2: NodeType = async (state, runtime) => { runtime.interrupt.doInterrupt(1); return { bar: state.foo + ' is' }; }; const graph = builder .addNode('node1', node1) .addNode('node2', node2) .addEdge(START, 'node1') .addEdge('node1', 'node2') .addEdge('node2', END) .compile(); await graph.invoke({ foo: '', bar: 'My' }); ``` ### Error Message and Stack Trace (if applicable) No overload matches this call. Overload 1 of 4, '(key: "node2", action: NodeAction<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>>, StateDefinition, unknown, unknown>, options?: StateGraphAddNodeOptions<...> | undefined): StateGraph<...>', gave the following error. Argument of type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> | Command<...>, Runtime<...>>' is not assignable to parameter of type 'NodeAction<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>>, StateDefinition, unknown, unknown>'. Type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> | Command<...>, Runtime<...>>' is not assignable to type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> & Record<...>, Runtime<...>>'. Type 'Runtime<StateType<StateDefinition>, unknown, unknown>' is not assignable to type 'Runtime<StateType<StateDefinition>, { doInterrupt: (value: number) => string; }, unknown>'. Types of property 'interrupt' are incompatible. Type '(value: unknown) => unknown' is not assignable to type '{ doInterrupt: (value: number) => string; }'. Overload 2 of 4, '(key: "node2", action: NodeAction<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>>, StateDefinition, unknown, unknown>, options?: StateGraphAddNodeOptions<...> | undefined): StateGraph<...>', gave the following error. Argument of type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> | Command<...>, Runtime<...>>' is not assignable to parameter of type 'NodeAction<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>>, StateDefinition, unknown, unknown>'. Type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> | Command<...>, Runtime<...>>' is not assignable to type 'RunnableFunc$1<{ foo: string; bar: string; }, UpdateType<InteropZodToStateDefinition<ZodObject<{ foo: ZodString; bar: ZodString; }, $strip>, { foo: ZodString; bar: ZodString; }>> & Record<...>, Runtime<...>>'. Type 'Runtime<StateType<StateDefinition>, unknown, unknown>' is not assignable to type 'Runtime<StateType<StateDefinition>, { doInterrupt: (value: number) => string; }, unknown>'. Types of property 'interrupt' are incompatible. Type '(value: unknown) => unknown' is not assignable to type '{ doInterrupt: (value: number) => string; }'. ### Description When creating a simple graph with a state schema and a graph config, then any node not defined inline will fail with a type error. This isn't caught in a langgraph unit test because the only test that adds nodes this way doesn't chain the calls and adds them separately. https://github.com/langchain-ai/langgraphjs/blob/18abe1e813e1631a03bad39e20e64099d18d48d7/libs/langgraph-core/src/tests/pregel.test-d.ts#L601 ### System Info Node version: v22.19.0 Operating system: darwin arm64 Package manager: npm Package manager version: N/A -------------------- @langchain/core -> @1.0.2, , @"^1.0.2", @"^1.0.1", @"^0.3.59, @"^1.0.0" langsmith -> @0.3.71, , @"^0.3.64", @"^0.3.33" zod -> @4.1.12, , @"^4.1.12", @"^4.1.11", @"^3.25, @"^3.25.76, @"^3.25.32, @3.23.8, @"3.23.8", @3.25.76, @"^3.19.1" @langchain/langgraph-checkpoint-postgres -> @1.0.0, , @"^1.0.0" @langchain/langgraph-checkpoint -> @1.0.0, , @"^1.0.0", @"~0.0.16 @langchain/langgraph-cli -> @1.0.3, , @"^1.0.3" @langchain/langgraph-api -> @1.0.3, , @"1.0.3" @langchain/langgraph-sdk -> @1.0.0, , @"~1.0.0", @"~0.0.16 @langchain/langgraph-ui -> @1.0.3, , @"1.0.3" @langchain/langgraph -> @1.0.1, , @"^1.0.1", @"^0.2.57 @langchain/openai -> @1.0.0, , @"^1.0.0"
Author
Owner

@imkrish7 commented on GitHub (Jan 28, 2026):

I suggest you check what each node is returning, as this will resolve your issue. You can either return a partial result or the full state at each node.

@imkrish7 commented on GitHub (Jan 28, 2026): I suggest you check what each node is returning, as this will resolve your issue. You can either return a partial result or the full state at each node.
Author
Owner

@adm-robinweston commented on GitHub (Jan 28, 2026):

See the example in the issue description, where the state is returned from each node

@adm-robinweston commented on GitHub (Jan 28, 2026): See the example in the issue description, where the state is returned from each node
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#378