Internal Server Error #12265

Closed
opened 2026-02-21 19:06:38 -05:00 by yindo · 3 comments
Owner

Originally created by @jy951126 on GitHub (Mar 27, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Image

After I completed the initial installation of Dify, it ran normally at first. However, after running for about one or two days, the error occurred.

When I checked the Pod logs, I found the error message shown in the screenshot.

I also tried setting SQLALCHEMY_POOL_PRE_PING=true and SQLALCHEMY_POOL_RECYCLE=900, but these changes did not resolve the issue.

✔️ Expected Behavior

I expect the application to continue running normally.

Actual Behavior

The application still returns an Internal Server Error.

Originally created by @jy951126 on GitHub (Mar 27, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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 submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ![Image](https://github.com/user-attachments/assets/0f0595fd-cfac-4b0e-a1c0-1b651274f236) After I completed the initial installation of Dify, it ran normally at first. However, after running for about one or two days, the error occurred. When I checked the Pod logs, I found the error message shown in the screenshot. I also tried setting SQLALCHEMY_POOL_PRE_PING=true and SQLALCHEMY_POOL_RECYCLE=900, but these changes did not resolve the issue. ### ✔️ Expected Behavior I expect the application to continue running normally. ### ❌ Actual Behavior The application still returns an Internal Server Error.
yindo added the 🐞 bug label 2026-02-21 19:06:38 -05:00
yindo closed this issue 2026-02-21 19:06:38 -05:00
Author
Owner

@jy951126 commented on GitHub (Mar 27, 2025):

And I contacted the DBA to check whether there was any restart, anomaly, or abnormal connection count in PostgreSQL, and he confirmed that everything was normal

@jy951126 commented on GitHub (Mar 27, 2025): And I contacted the DBA to check whether there was any restart, anomaly, or abnormal connection count in PostgreSQL, and he confirmed that everything was normal
Author
Owner

@dosubot[bot] commented on GitHub (Mar 27, 2025):

I found a similar closed issue where a solution was suggested for a database connection problem. The solution involved adjusting the environment variable SQLALCHEMY_POOL_SIZE for both the API and worker services to fit the connection pool configuration of PostgreSQL [1].

Additionally, a common cause of OperationalError in SQLAlchemy when using PostgreSQL with Dify is related to using an incorrect model configuration. Specifically, using 'deepseek-r1:7b', which is not an embedding model, can lead to connection termination issues. Configuring Dify to use a proper embedding model instead of 'deepseek-r1:7b' resolves the PostgreSQL connection errors [2].

You might want to check these configurations and see if they help resolve the issue.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 27, 2025): <!-- Answer --> I found a similar closed issue where a solution was suggested for a database connection problem. The solution involved adjusting the environment variable `SQLALCHEMY_POOL_SIZE` for both the API and worker services to fit the connection pool configuration of PostgreSQL <sup>[[1]](https://github.com/langgenius/dify/issues/472)</sup>. Additionally, a common cause of `OperationalError` in SQLAlchemy when using PostgreSQL with Dify is related to using an incorrect model configuration. Specifically, using 'deepseek-r1:7b', which is not an embedding model, can lead to connection termination issues. Configuring Dify to use a proper embedding model instead of 'deepseek-r1:7b' resolves the PostgreSQL connection errors <sup>[[2]](https://github.com/langgenius/dify/issues/13829)</sup>. You might want to check these configurations and see if they help resolve the issue. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/1be20d32-6d89-494b-9f05-6f71bed98f1b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1be20d32-6d89-494b-9f05-6f71bed98f1b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1be20d32-6d89-494b-9f05-6f71bed98f1b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1be20d32-6d89-494b-9f05-6f71bed98f1b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1be20d32-6d89-494b-9f05-6f71bed98f1b?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/1be20d32-6d89-494b-9f05-6f71bed98f1b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1be20d32-6d89-494b-9f05-6f71bed98f1b?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Mar 27, 2025):

This seems to be a network issue while connecting to the db.

@crazywoola commented on GitHub (Mar 27, 2025): This seems to be a network issue while connecting to the db.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12265