[GH-ISSUE #480] Invalid update for channel "jumpTo" with values [null,null] when responseFormat is not respected by model provider and afterModel middleware is present #262

Open
opened 2026-06-05 17:21:20 -04:00 by yindo · 1 comment
Owner

Originally created by @mattCohesion on GitHub (Apr 21, 2026).
Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/480

Originally assigned to: @hntrl on GitHub.

Summary

DeepAgents will throw Invalid update for channel "jumpTo" with values [null,null] when the model provider returns a response that does not align with the structured response format passed to the DeepAgent and an afterModel middleware is present. This leads to an InvalidUpdateError error that fails the DeepAgents invoke request.

Full Error

InvalidUpdateError: Invalid update for channel "jumpTo" with values [null,null]: UntrackedValue(guard=true) can receive only one value per step. Use guard=false if you want to store any one of multiple values.

Troubleshooting URL: https://docs.langchain.com/oss/javascript/langgraph/INVALID_CONCURRENT_GRAPH_UPDATE/

lc_error_code: "INVALID_CONCURRENT_GRAPH_UPDATE",

    at _applyWrites (/path/to/my/workspace/node_modules/.bun/@langchain+langgraph@1.2.8+2c9d01ca90c00f9f/node_modules/@langchain/langgraph/dist/pregel/algo.js:120:30)
    at tick (/path/to/my/workspace/node_modules/.bun/@langchain+langgraph@1.2.8+2c9d01ca90c00f9f/node_modules/@langchain/langgraph/dist/pregel/loop.js:332:27)
    at _runLoop (/path/to/my/workspace/node_modules/.bun/@langchain+langgraph@1.2.8+2c9d01ca90c00f9f/node_modules/@langchain/langgraph/dist/pregel/index.js:1143:22)
    at processTicksAndRejections (native:7:39)

Code Reproduction

Executing this code reproduces the error exactly.

import {createDeepAgent} from 'deepagents';
import {createMiddleware} from 'langchain';
import {z} from 'zod';

const agent = createDeepAgent({
  model: 'claude-sonnet-4-6',
  systemPrompt: 'Return an empty response array.',
  tools: [],
  subagents: [],
  middleware: [
    createMiddleware({
      name: 'NoopAfterModelMiddleware',
      afterModel: {
        hook: async () => {},
      },
    }),
  ],
  responseFormat: z.object({
    response: z.array(z.string()).min(1),
  }),
});

try {
  const result = await agent.invoke({
    messages: [
      {
        role: 'user',
        content: 'Respond with {"response":[]}.',
      },
    ],
    files: {},
  });

  console.log(JSON.stringify(result, null, 2));
} catch (error) {
  console.error(error);
}

Details

I provided a response format that required at least 1 value in an array with zod like: z.array(z.string()).min(1). However, the model would sometimes decide there was no relevant output and return just [], leading to this issue.

When attempting to reproduce this, I learned that simply providing a response format that is not supported by the model provider (e.g. Anthropic calls out their lack of support for min on zod arrays here) is not sufficient, and it requires the middleware to be present for the bug to trip.

I am a not a contributor to DeepAgents so I am not sure how to rectify this issue.

Library Versions

bun --cwd packages/agentTooling -e "const names = ['langchain', '@langchain/langgraph', 'deepagents']; for (const name of names) { const path = require.resolve(name + '/package.json'); const pkg = await import(path, { with: { type: 'json' } }); console.log(name + '@' + pkg.default.version); }"

langchain@1.3.3
@langchain/langgraph@1.2.8
deepagents@1.9.0

Workaround

Do not provide overly strict response formats that the model provider cannot conform to. Example, making the following change to the reproduction code above will execute successfully:

   ],
   responseFormat: z.object({
-    response: z.array(z.string()).min(1),
+    response: z.array(z.string()),
   }),
 });
Originally created by @mattCohesion on GitHub (Apr 21, 2026). Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/480 Originally assigned to: @hntrl on GitHub. ## Summary DeepAgents will throw `Invalid update for channel "jumpTo" with values [null,null]` when the model provider returns a response that does not align with the structured response format passed to the DeepAgent *and* an afterModel middleware is present. This leads to an `InvalidUpdateError ` error that fails the DeepAgents `invoke` request. ## Full Error ```bash InvalidUpdateError: Invalid update for channel "jumpTo" with values [null,null]: UntrackedValue(guard=true) can receive only one value per step. Use guard=false if you want to store any one of multiple values. Troubleshooting URL: https://docs.langchain.com/oss/javascript/langgraph/INVALID_CONCURRENT_GRAPH_UPDATE/ lc_error_code: "INVALID_CONCURRENT_GRAPH_UPDATE", at _applyWrites (/path/to/my/workspace/node_modules/.bun/@langchain+langgraph@1.2.8+2c9d01ca90c00f9f/node_modules/@langchain/langgraph/dist/pregel/algo.js:120:30) at tick (/path/to/my/workspace/node_modules/.bun/@langchain+langgraph@1.2.8+2c9d01ca90c00f9f/node_modules/@langchain/langgraph/dist/pregel/loop.js:332:27) at _runLoop (/path/to/my/workspace/node_modules/.bun/@langchain+langgraph@1.2.8+2c9d01ca90c00f9f/node_modules/@langchain/langgraph/dist/pregel/index.js:1143:22) at processTicksAndRejections (native:7:39) ``` ## Code Reproduction Executing this code reproduces the error exactly. ```typescript import {createDeepAgent} from 'deepagents'; import {createMiddleware} from 'langchain'; import {z} from 'zod'; const agent = createDeepAgent({ model: 'claude-sonnet-4-6', systemPrompt: 'Return an empty response array.', tools: [], subagents: [], middleware: [ createMiddleware({ name: 'NoopAfterModelMiddleware', afterModel: { hook: async () => {}, }, }), ], responseFormat: z.object({ response: z.array(z.string()).min(1), }), }); try { const result = await agent.invoke({ messages: [ { role: 'user', content: 'Respond with {"response":[]}.', }, ], files: {}, }); console.log(JSON.stringify(result, null, 2)); } catch (error) { console.error(error); } ``` ## Details I provided a response format that required at least 1 value in an array with zod like: `z.array(z.string()).min(1)`. However, the model would sometimes decide there was no relevant output and return just `[]`, leading to this issue. When attempting to reproduce this, I learned that simply providing a response format that is not supported by the model provider (e.g. Anthropic calls out their lack of support for `min` on zod arrays [here](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)) is not sufficient, and it requires the middleware to be present for the bug to trip. I am a not a contributor to DeepAgents so I am not sure how to rectify this issue. #### Library Versions ``` bun --cwd packages/agentTooling -e "const names = ['langchain', '@langchain/langgraph', 'deepagents']; for (const name of names) { const path = require.resolve(name + '/package.json'); const pkg = await import(path, { with: { type: 'json' } }); console.log(name + '@' + pkg.default.version); }" langchain@1.3.3 @langchain/langgraph@1.2.8 deepagents@1.9.0 ``` ## Workaround Do not provide overly strict response formats that the model provider cannot conform to. Example, making the following change to the reproduction code above will execute successfully: ``` ], responseFormat: z.object({ - response: z.array(z.string()).min(1), + response: z.array(z.string()), }), }); ```
yindo added the bugtriage: high-impactneeds-response labels 2026-06-05 17:21:20 -04:00
Author
Owner

@hntrl commented on GitHub (Jun 2, 2026):

Thanks for the report! Fixing in https://github.com/langchain-ai/langchainjs/pull/11015

<!-- gh-comment-id:4607510123 --> @hntrl commented on GitHub (Jun 2, 2026): Thanks for the report! Fixing in https://github.com/langchain-ai/langchainjs/pull/11015
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#262