Error "EmptyChannelError" on Vercel #20

Closed
opened 2026-02-15 17:05:33 -05:00 by yindo · 5 comments
Owner

Originally created by @barbudour on GitHub (Apr 9, 2024).

Hi, I'm trying to run the code on Vercel but I'm getting an EmptyChannelError. I am using the code from this example. On local environment everything works fine, but when I run the application in Vercel environment I get this error:

 EmptyChannelError: 
    at (node_modules/@langchain/langgraph/dist/channels/last_value.js:39:18)
    at (node_modules/@langchain/langgraph/dist/pregel/index.js:320:30)
    at (node_modules/@langchain/langgraph/dist/pregel/index.js:206:31)
    at (node_modules/@langchain/langgraph/dist/pregel/read.js:51:81)
    at (node_modules/@langchain/langgraph/dist/pregel/read.js:51:60)
    at (node_modules/@langchain/langgraph/dist/pregel/read.js:9:32)
    at (node_modules/@langchain/core/dist/runnables/base.js:1348:44)
    at (node_modules/@langchain/core/dist/runnables/base.js:1346:66) {
  name: 'EmptyChannelError'
}
Originally created by @barbudour on GitHub (Apr 9, 2024). Hi, I'm trying to run the code on Vercel but I'm getting an EmptyChannelError. I am using the code from this [example](https://github.com/langchain-ai/langgraphjs/blob/main/examples/multi_agent/agent_supervisor.ipynb). On local environment everything works fine, but when I run the application in Vercel environment I get this error: ``` EmptyChannelError: at (node_modules/@langchain/langgraph/dist/channels/last_value.js:39:18) at (node_modules/@langchain/langgraph/dist/pregel/index.js:320:30) at (node_modules/@langchain/langgraph/dist/pregel/index.js:206:31) at (node_modules/@langchain/langgraph/dist/pregel/read.js:51:81) at (node_modules/@langchain/langgraph/dist/pregel/read.js:51:60) at (node_modules/@langchain/langgraph/dist/pregel/read.js:9:32) at (node_modules/@langchain/core/dist/runnables/base.js:1348:44) at (node_modules/@langchain/core/dist/runnables/base.js:1346:66) { name: 'EmptyChannelError' } ```
yindo closed this issue 2026-02-15 17:05:34 -05:00
Author
Owner

@sheldonj commented on GitHub (Apr 16, 2024):

Im also getting this error in production on vercel, and its working no problem locally.
tried both using just server actions and a dedicated api route with both nodejs and edge runtimes with the same result.

Happy to try and help with this issue, but need a poke in the right direction to determine what might be the cause of the issue.

@sheldonj commented on GitHub (Apr 16, 2024): Im also getting this error in production on vercel, and its working no problem locally. tried both using just server actions and a dedicated api route with both nodejs and edge runtimes with the same result. Happy to try and help with this issue, but need a poke in the right direction to determine what might be the cause of the issue.
Author
Owner

@sheldonj commented on GitHub (Apr 16, 2024):

@barbudour are you using a CheckpointSaver in your implementation?

@sheldonj commented on GitHub (Apr 16, 2024): @barbudour are you using a CheckpointSaver in your implementation?
Author
Owner

@barbudour commented on GitHub (Apr 16, 2024):

@sheldonj hi, I don't use CheckpointSaver. I managed to solve the problem, I think there is a bug in the example in the documentation. I changed the following code and it worked in the Vercel environment.

Example:

interface AgentStateChannels {
  messages: {
    value: (x: BaseMessage[], y: BaseMessage[]) => BaseMessage[];
    default: () => BaseMessage[];
  };
  next: string;
}

// This defines the agent state
const agentStateChannels: AgentStateChannels = {
  messages: {
    value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),
    default: () => [],
  },
  next: 'initialValueForNext', // Replace 'initialValueForNext' with your initial value if needed
};

My code:

interface AgentStateChannels {
  messages: {
    value: (x: BaseMessage[], y: BaseMessage[]) => BaseMessage[];
    default: () => BaseMessage[];
  };
  next: {
    value: (x: BaseMessage[], y: BaseMessage[]) => BaseMessage[];
    default: () => BaseMessage[];
  };
}

// This defines the agent state
const agentStateChannels: AgentStateChannels = {
  messages: {
    value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),
    default: () => [],
},
  next: {
    value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y),
    default: () => [],
  }
};
@barbudour commented on GitHub (Apr 16, 2024): @sheldonj hi, I don't use CheckpointSaver. I managed to solve the problem, I think there is a bug in the example in the documentation. I changed the following code and it worked in the Vercel environment. Example: ```typescript interface AgentStateChannels { messages: { value: (x: BaseMessage[], y: BaseMessage[]) => BaseMessage[]; default: () => BaseMessage[]; }; next: string; } // This defines the agent state const agentStateChannels: AgentStateChannels = { messages: { value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y), default: () => [], }, next: 'initialValueForNext', // Replace 'initialValueForNext' with your initial value if needed }; ``` My code: ```typescript interface AgentStateChannels { messages: { value: (x: BaseMessage[], y: BaseMessage[]) => BaseMessage[]; default: () => BaseMessage[]; }; next: { value: (x: BaseMessage[], y: BaseMessage[]) => BaseMessage[]; default: () => BaseMessage[]; }; } // This defines the agent state const agentStateChannels: AgentStateChannels = { messages: { value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y), default: () => [], }, next: { value: (x: BaseMessage[], y: BaseMessage[]) => x.concat(y), default: () => [], } }; ```
Author
Owner

@rossanodr commented on GitHub (Jun 18, 2024):

@barbudour are you using a CheckpointSaver in your implementation?

did you managed to solve it?

@rossanodr commented on GitHub (Jun 18, 2024): > @barbudour are you using a CheckpointSaver in your implementation? did you managed to solve it?
Author
Owner

@barbudour commented on GitHub (Jun 19, 2024):

@rossanodr yes, I was able to solve the problem, I have attached the code to the post above

@barbudour commented on GitHub (Jun 19, 2024): @rossanodr yes, I was able to solve the problem, I have attached the code to the post above
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#20