Minified React error #185 #1041

Closed
opened 2026-02-21 17:29:38 -05:00 by yindo · 8 comments
Owner

Originally created by @perzeuss on GitHub (Feb 7, 2024).

Originally assigned to: @iamjoel, @zxhlyh on GitHub.

Self Checks

Dify version

0.5.4

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  • Create a Basic Assistant
  • Select GPT 3.5 Turbo
  • Make the GPT generate a large text

✔️ Expected Behavior

Text is beeing generated normally

Actual Behavior

Text generation aborts after 1 second and the frontend throws the error Minified React error #185..

Originally created by @perzeuss on GitHub (Feb 7, 2024). Originally assigned to: @iamjoel, @zxhlyh on GitHub. ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to file this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). ### Dify version 0.5.4 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce - Create a Basic Assistant - Select GPT 3.5 Turbo - Make the GPT generate a large text ### ✔️ Expected Behavior Text is beeing generated normally ### ❌ Actual Behavior Text generation aborts after 1 second and the frontend throws the error [Minified React error #185](https://react.dev/errors/185?invariant=185)..
yindo added the 🐞 bug label 2026-02-21 17:29:38 -05:00
yindo closed this issue 2026-02-21 17:29:38 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 7, 2024):

🤖

Hey there @perzeuss! 😄 Great to see you back. Seems like you've stumbled upon something quirky again. Don't worry, I'm on it and will get back to you with a full answer shortly!

@dosubot[bot] commented on GitHub (Feb 7, 2024): _🤖_ <!-- Greeting --> Hey there @perzeuss! 😄 Great to see you back. Seems like you've stumbled upon something quirky again. Don't worry, I'm on it and will get back to you with a full answer shortly!
Author
Owner

@perzeuss commented on GitHub (Feb 7, 2024):

Obvious Issue is, that the model is so fast that setState is called too often. @dosubot suggest a few solutions to prevent it ;)

@perzeuss commented on GitHub (Feb 7, 2024): Obvious Issue is, that the model is so fast that `setState` is called too often. @dosubot suggest a few solutions to prevent it ;)
Author
Owner

@dosubot[bot] commented on GitHub (Feb 7, 2024):

🤖

Thank you for reporting this issue. It seems like you're encountering a common problem in React applications where state updates are happening too frequently, causing the application to crash with a Minified React error #185.

Based on the context provided, the dify frontend uses React's Context API and the useState hook for state management. The issue you're experiencing might be due to the fact that setState is being called too often, especially when generating large text with GPT 3.5 Turbo.

One possible solution to this problem is to throttle or debounce the setState calls. Throttling and debouncing are techniques that can limit the rate at which a function is executed. In this case, you could throttle or debounce the function that calls setState to prevent it from being called too frequently.

Here's an example of how you could implement a debounce function:

function debounce(func, wait) {
  let timeout;

  return function executedFunction(...args) {
    const later = () => {
      clearTimeout(timeout);
      func(...args);
    };

    clearTimeout(timeout);
    timeout = setTimeout(later, wait);
  };
};

// Usage
const debouncedSetState = debounce(setState, 300);

In this example, debouncedSetState is a debounced version of setState that will only be executed 300ms after the last time it was invoked.

Another possible solution is to use a different state management library that can handle frequent state updates more efficiently, such as Redux or MobX. However, this would likely require significant changes to your codebase.

Please note that these are just suggestions and might not completely solve your issue. If the problem persists, it would be helpful to have more information about the specific part of your code that's causing the issue. For example, a code snippet or a more detailed description of the steps to reproduce the issue could be very useful.

I hope this helps! If you have any other questions, feel free to ask.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Feb 7, 2024): _🤖_ <!-- Answer --> Thank you for reporting this issue. It seems like you're encountering a common problem in React applications where state updates are happening too frequently, causing the application to crash with a [Minified React error #185](https://react.dev/errors/185?invariant=185). Based on the context provided, the dify frontend uses React's Context API and the useState hook for state management. The issue you're experiencing might be due to the fact that `setState` is being called too often, especially when generating large text with GPT 3.5 Turbo. One possible solution to this problem is to throttle or debounce the `setState` calls. Throttling and debouncing are techniques that can limit the rate at which a function is executed. In this case, you could throttle or debounce the function that calls `setState` to prevent it from being called too frequently. Here's an example of how you could implement a debounce function: ```jsx function debounce(func, wait) { let timeout; return function executedFunction(...args) { const later = () => { clearTimeout(timeout); func(...args); }; clearTimeout(timeout); timeout = setTimeout(later, wait); }; }; // Usage const debouncedSetState = debounce(setState, 300); ``` In this example, `debouncedSetState` is a debounced version of `setState` that will only be executed 300ms after the last time it was invoked. Another possible solution is to use a different state management library that can handle frequent state updates more efficiently, such as Redux or MobX. However, this would likely require significant changes to your codebase. Please note that these are just suggestions and might not completely solve your issue. If the problem persists, it would be helpful to have more information about the specific part of your code that's causing the issue. For example, a code snippet or a more detailed description of the steps to reproduce the issue could be very useful. I hope this helps! If you have any other questions, feel free to ask. ## Sources - [web/context/modal-context.tsx](https://github.com/langgenius/dify/blob/main/web/context/modal-context.tsx) - [web/app/components/app/log/list.tsx](https://github.com/langgenius/dify/blob/main/web/app/components/app/log/list.tsx) --- This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.
Author
Owner

@perzeuss commented on GitHub (Feb 7, 2024):

Looks like this is a critical bug, we also get this error with GPT 4. We have to roll back and migrate the db to 0.5.3.

@perzeuss commented on GitHub (Feb 7, 2024): Looks like this is a critical bug, we also get this error with GPT 4. We have to roll back and migrate the db to 0.5.3.
Author
Owner

@perzeuss commented on GitHub (Feb 7, 2024):

In case someone needs to roll back too: run flask db downgrade 380c6aa5a70d to migrate to 0.5.3 db schema.

@perzeuss commented on GitHub (Feb 7, 2024): In case someone needs to roll back too: run `flask db downgrade 380c6aa5a70d` to migrate to 0.5.3 db schema.
Author
Owner

@perzeuss commented on GitHub (Feb 7, 2024):

@iamjoel @zxhlyh fyi: I was able to reproduce this issue with 0.5.3 too. No issue with 0.5.2.

@perzeuss commented on GitHub (Feb 7, 2024): @iamjoel @zxhlyh fyi: I was able to reproduce this issue with 0.5.3 too. No issue with 0.5.2.
Author
Owner

@zxhlyh commented on GitHub (Feb 7, 2024):

@perzeuss I'm sorry about the problem, could you try the latest main branch and see if that solves your problem?

@zxhlyh commented on GitHub (Feb 7, 2024): @perzeuss I'm sorry about the problem, could you try the latest main branch and see if that solves your problem?
Author
Owner

@perzeuss commented on GitHub (Feb 27, 2024):

@perzeuss I'm sorry about the problem, could you try the latest main branch and see if that solves your problem?

The issue has been fixed with one of the recent releases.

@perzeuss commented on GitHub (Feb 27, 2024): > @perzeuss I'm sorry about the problem, could you try the latest main branch and see if that solves your problem? The issue has been fixed with one of the recent releases.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1041