Skip to content

[Bug] Maximum update depth exceeded (even in openai-chatkit-starter-app) #121

@wichniew

Description

@wichniew

This error appears from time to time in the browser console during chat:

Minified React error #185

Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

index-B5Rsjn5T.js:295 Error handling thread event Error: Minified React error #185; visit https://react.dev/errors/185 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at g6 (index-B5Rsjn5T.js:48:30072)
at mo (index-B5Rsjn5T.js:48:29660)
at UI (index-B5Rsjn5T.js:48:47895)
at index-B5Rsjn5T.js:48:47776
at index-B5Rsjn5T.js:161:51221
at Set.forEach ()
at r (index-B5Rsjn5T.js:161:51210)
at r.setState (index-B5Rsjn5T.js:161:59532)
at Uce.handleThreadEvent (index-B5Rsjn5T.js:295:31344)
at Uce.handleThreadStream (index-B5Rsjn5T.js:295:26324)

The problem occurs even in the unmodified starter app downloaded today from the repository https://github.com/openai/openai-chatkit-starter-app, following the installation instructions exactly.

Environment:

Node.js: 15.5.4
PNPM: 10.24.0
react: 19.2.0
openai-chatkit-js: 1.3.0
Browser: Chrome 142.0.7444.176 without any extensions
OS: macOS

Steps to reproduce:

Clone the starter repository:

git clone https://github.com/openai/openai-chatkit-starter-app.git
cd openai-chatkit-starter-app
Install dependencies:

pnpm install

Start the app:

pnpm run dev

After opening localhost:3000 (or another port), the error appears in the browser console not immediately, but after some messages sent by the user and received from the agent (somethimes two, sometimes more, but 10 messages seems to be enough).

Additional information:

Tried different React / ChatKit versions, the error persists.

No custom hooks or effects around ChatKit; tested on fresh starter code.

Could not find any workaround or FAQ for this issue.

When this error occurs, I don't see anything stopping working—nevertheless, it is disturbing.

The error seems independent of the agent workflow complexity. It occurs even with the simplest, default one (it is the code copy from the agent builder export):

import { Agent, AgentInputItem, Runner, withTrace } from "@openai/agents";

const test = new Agent({
  name: "Test",
  instructions: "You are a helpful assistant.",
  model: "gpt-5.1",
  modelSettings: {
    reasoning: {
      effort: "low",
      summary: "auto"
    },
    store: true
  }
});

type WorkflowInput = { input_as_text: string };


// Main code entrypoint
export const runWorkflow = async (workflow: WorkflowInput) => {
  return await withTrace("Test", async () => {
    const state = {

    };
    const conversationHistory: AgentInputItem[] = [
      { role: "user", content: [{ type: "input_text", text: workflow.input_as_text }] }
    ];
    const runner = new Runner({
      traceMetadata: {
        __trace_source__: "agent-builder",
        workflow_id: "....."
      }
    });
    const testResultTemp = await runner.run(
      test,
      [
        ...conversationHistory
      ]
    );
    conversationHistory.push(...testResultTemp.newItems.map((item) => item.rawItem));

    if (!testResultTemp.finalOutput) {
        throw new Error("Agent result is undefined");
    }

    const testResult = {
      output_text: testResultTemp.finalOutput ?? ""
    };
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions