plugin-daemon: Unable to connect to Postgres #20573

Closed
opened 2026-02-21 20:08:00 -05:00 by yindo · 9 comments
Owner

Originally created by @marcelgoya on GitHub (Nov 26, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

v1.10.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I just upgraded from v1.10.0 to the latest v1.10.1 and the langgenius/dify-plugin-daemon:0.4.1-local container is giving me the following error message:

2025/11/26 11:37:57 /app/internal/db/pg/pg.go:30
[error] failed to initialize database, got error failed to connect to `host=db_postgres user=postgres database=dify_plugin`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving)

2025/11/26 11:37:57 /app/internal/db/pg/pg.go:34
[error] failed to initialize database, got error failed to connect to `host=db_postgres user=postgres database=postgres`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving)
2025/11/26 11:37:57 init.go:99: [PANIC]failed to init dify plugin db: failed to connect to `host=db_postgres user=postgres database=postgres`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving)
panic: [PANIC]failed to init dify plugin db: failed to connect to `host=db_postgres user=postgres database=postgres`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving)

✔️ Expected Behavior

Able to connect with Postgres DB

Actual Behavior

Not connecting

Originally created by @marcelgoya on GitHub (Nov 26, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version v1.10.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I just upgraded from v1.10.0 to the latest v1.10.1 and the langgenius/dify-plugin-daemon:0.4.1-local container is giving me the following error message: ``` 2025/11/26 11:37:57 /app/internal/db/pg/pg.go:30 [error] failed to initialize database, got error failed to connect to `host=db_postgres user=postgres database=dify_plugin`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving) 2025/11/26 11:37:57 /app/internal/db/pg/pg.go:34 [error] failed to initialize database, got error failed to connect to `host=db_postgres user=postgres database=postgres`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving) 2025/11/26 11:37:57 init.go:99: [PANIC]failed to init dify plugin db: failed to connect to `host=db_postgres user=postgres database=postgres`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving) panic: [PANIC]failed to init dify plugin db: failed to connect to `host=db_postgres user=postgres database=postgres`: hostname resolving error (lookup db_postgres on 127.0.0.11:53: server misbehaving) ``` ### ✔️ Expected Behavior Able to connect with Postgres DB ### ❌ Actual Behavior Not connecting
yindo added the 🐞 bug label 2026-02-21 20:08:00 -05:00
yindo closed this issue 2026-02-21 20:08:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 26, 2025):

Hi @marcelgoya! I'm Dosu and I’m helping the dify team.

There are no changes in the docker-compose or environment files between v1.10.0 and v1.10.1 that would explain a new hostname resolution failure for db_postgres. Both plugin_daemon and db_postgres are attached to the default Docker network, which should allow hostname resolution via Docker's internal DNS. The error you’re seeing (lookup db_postgres on 127.0.0.11:53: server misbehaving) suggests a runtime DNS issue inside the container, not a config or code change reference.

Here are some targeted steps to troubleshoot:

  • Make sure the db_postgres container is running and healthy (docker ps and docker inspect for health status).
  • Restart both db_postgres and plugin-daemon containers to clear any transient DNS issues.
  • If the problem persists, try recreating the Docker network (docker-compose down -v and then docker-compose up -d).
  • Check that your Docker version is up to date and that no system-level DNS changes have been made recently.
  • If you have custom Docker networks or have modified network settings, ensure both services are on the same network.

If you still see the DNS error after these steps, please share the output of docker network inspect for the relevant network and any logs from the db_postgres container.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 26, 2025): <!-- Greeting --> Hi @marcelgoya! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> There are no changes in the docker-compose or environment files between v1.10.0 and v1.10.1 that would explain a new hostname resolution failure for `db_postgres`. Both `plugin_daemon` and `db_postgres` are attached to the default Docker network, which should allow hostname resolution via Docker's internal DNS. The error you’re seeing (lookup `db_postgres` on 127.0.0.11:53: server misbehaving) suggests a runtime DNS issue inside the container, not a config or code change [reference](https://github.com/langgenius/dify/blob/b353a126d8fd24028c24b2e89015ee1fe9629682/docker/docker-compose-template.yaml#L136-L314). Here are some targeted steps to troubleshoot: - Make sure the `db_postgres` container is running and healthy (`docker ps` and `docker inspect` for health status). - Restart both `db_postgres` and `plugin-daemon` containers to clear any transient DNS issues. - If the problem persists, try recreating the Docker network (`docker-compose down -v` and then `docker-compose up -d`). - Check that your Docker version is up to date and that no system-level DNS changes have been made recently. - If you have custom Docker networks or have modified network settings, ensure both services are on the same network. If you still see the DNS error after these steps, please share the output of `docker network inspect` for the relevant network and any logs from the `db_postgres` container. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/3f031502-c708-484a-a66a-0c14f3c77725?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/3f031502-c708-484a-a66a-0c14f3c77725?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/3f031502-c708-484a-a66a-0c14f3c77725?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/3f031502-c708-484a-a66a-0c14f3c77725?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3f031502-c708-484a-a66a-0c14f3c77725?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/3f031502-c708-484a-a66a-0c14f3c77725?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/3f031502-c708-484a-a66a-0c14f3c77725?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=There%20are%20no%20changes%20in%20the%20docker-compose%20or%20environment%20files%20between%20v1.10.0%20and%20v1.10.1%20that%20would%20explain%20a%20new%20hostname%20resolution%20failure%20for%20%60db_postgres%60.%20Both%20%60plugin_daemon%60%20and%20%60db_postgres%60%20are%20attached%20to%20the%20default%20Docker%20network%2C%20which%20should%20allow%20hostname%20resolution%20via%20Docker%27s%20internal%20DNS.%20The%20error%20you%E2%80%99re%20seeing%20%28lookup%20%60db_postgres%60%20on%20127.0.0.11%3A53%3A%20server%20misbehaving%29%20suggests%20a%20runtime%20DNS%20issue%20inside%20the%20container%2C%20not%20a%20config%20or%20code%20change%C2%A0%5Breference%5D%28https%3A//github.com/langgenius/dify/blob/b353a126d8fd24028c24b2e89015ee1fe9629682/docker/docker-compose-template.yaml%23L136-L314%29.%0A%0AHere%20are%20some%20targeted%20steps%20to%20troubleshoot%3A%0A%0A-%20Make%20sure%20the%20%60db_postgres%60%20container%20is%20running%20and%20healthy%20%28%60docker%20ps%60%20and%20%60docker%20inspect%60%20for%20health%20status%29.%0A-%20Restart%20both%20%60db_postgres%60%20and%20%60plugin-daemon%60%20containers%20to%20clear%20any%20transient%20DNS%20issues.%0A-%20If%20the%20problem%20persists%2C%20try%20recreating%20the%20Docker%20network%20%28%60docker-compose%20down%20-v%60%20and%20then%20%60docker-compose%20up%20-d%60%29.%0A-%20Check%20that%20your%20Docker%20version%20is%20up%20to%20date%20and%20that%20no%20system-level%20DNS%20changes%20have%20been%20made%20recently.%0A-%20If%20you%20have%20custom%20Docker%20networks%20or%20have%20modified%20network%20settings%2C%20ensure%20both%20services%20are%20on%20the%20same%20network.%0A%0AIf%20you%20still%20see%20the%20DNS%20error%20after%20these%20steps%2C%20please%20share%20the%20output%20of%20%60docker%20network%20inspect%60%20for%20the%20relevant%20network%20and%20any%20logs%20from%20the%20%60db_postgres%60%20container.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28706)
Author
Owner

@koalababy2024 commented on GitHub (Nov 26, 2025):

same as me

@koalababy2024 commented on GitHub (Nov 26, 2025): same as me
Author
Owner

@marcelgoya commented on GitHub (Nov 26, 2025):

The following command fixes the problem for now. Apparently it's a renaming issue ...

docker compose --profile postgresql up -d
@marcelgoya commented on GitHub (Nov 26, 2025): The following command fixes the problem for now. Apparently it's a renaming issue ... ``` docker compose --profile postgresql up -d ```
Author
Owner

@jlfloresTeika commented on GitHub (Nov 26, 2025):

Check .env.example for new postgres config. related environment variables.

Even with the docker compose --profile postgresql up -d

My docker stack that was working fine on the previous release it was unable to connect to database in this release.

Issue in my case was that those keys:

DB_TYPE=postgresql
DB_HOST=db_postgres

Were not updated (my fault).
DB_TYPE was not present and DB_HOST was pointed to db instead of db_postgres .

I've noticed by carefully examining diff --color=auto -u .env.example .env since the .env.example is up-to-date.

After update those env vars the stack with docker compose up -d came up working good again but with some lingering console errors that:

docker compose down
docker compose --profile postgresql up -d

Completely solved.

Very interested in what env vars are worth to keep an eye on for self-hosted instances to be in-line with the recent improvements and config requirements.

Million Thanks @crazywoola and team

@jlfloresTeika commented on GitHub (Nov 26, 2025): Check `.env.example` for new postgres config. related environment variables. Even with the `docker compose --profile postgresql up -d` My docker stack that was working fine on the previous release it was unable to connect to database in this release. Issue in my case was that those keys: ``` DB_TYPE=postgresql DB_HOST=db_postgres ``` Were not updated (my fault). `DB_TYPE` was not present and `DB_HOST` was pointed to `db` instead of `db_postgres` . I've noticed by carefully examining `diff --color=auto -u .env.example .env` since the .env.example is up-to-date. After update those env vars the stack with _docker compose up -d_ came up _working good_ again but with some lingering console errors that: ``` docker compose down docker compose --profile postgresql up -d ``` Completely solved. Very interested in what env vars are worth to keep an eye on for self-hosted instances to be in-line with the recent improvements and config requirements. Million Thanks @crazywoola and team
Author
Owner

@crafthm commented on GitHub (Dec 9, 2025):

same to me ,but this method 'docker compose --profile postgresql up -d' can't fix my dify.

@crafthm commented on GitHub (Dec 9, 2025): same to me ,but this method 'docker compose --profile postgresql up -d' can't fix my dify.
Author
Owner

@dht-hedaihua commented on GitHub (Dec 10, 2025):

The real reason is that the relevant configurations in the.env.example file have been changed, and the latest docker-compose.yaml file has renamed the original db service to db_postgres So the correct solution is to replace the updated .env file with the latest .env.example file, and then modify your exclusive configuration. Then execute docker compose up - d normally.

@dht-hedaihua commented on GitHub (Dec 10, 2025): The real reason is that the relevant configurations in the`.env.example` file have been changed, and the latest `docker-compose.yaml `file has renamed the original `db `service to `db_postgres` So the correct solution is to replace the updated `.env` file with the latest `.env.example` file, and then modify your exclusive configuration. Then execute `docker compose up - d ` normally.
Author
Owner

@crafthm commented on GitHub (Dec 15, 2025):

@dht-hedaihua thank you, it works.

@crafthm commented on GitHub (Dec 15, 2025): @dht-hedaihua thank you, it works.
Author
Owner

@0x5c0f commented on GitHub (Dec 16, 2025):

If your .env configuration file only contains key items, then you need to keep this configuration: COMPOSE_PROFILES=${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql}

@0x5c0f commented on GitHub (Dec 16, 2025): If your .env configuration file only contains key items, then you need to keep this configuration: COMPOSE_PROFILES=${VECTOR_STORE:-weaviate},${DB_TYPE:-postgresql}
Author
Owner

@Zhang-Man commented on GitHub (Dec 16, 2025):

Accoring @dht-hedaihua answer fix this bug from old version, you need rebuild .env file according to the lastest .env.example .

  1. cp .env .env-$(date +%s).bak
  2. open .env.example to configure your configuration.
  3. cp .env.example .env
  4. follow Upgrade Guide
  5. docker compose up -d
@Zhang-Man commented on GitHub (Dec 16, 2025): Accoring @dht-hedaihua answer fix this bug from old version, you need rebuild .env file according to the lastest .env.example . 1. cp .env .env-$(date +%s).bak 2. open .env.example to configure your configuration. 3. cp .env.example .env 4. follow Upgrade Guide 5. docker compose up -d
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20573