UnicodeDecodeError when running poetry run flask db upgrade due to PostgreSQL connection #10589

Closed
opened 2026-02-21 18:48:47 -05:00 by yindo · 0 comments
Owner

Originally created by @dennischan7 on GitHub (Mar 12, 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

1.0.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Python 3.12.6
Poetry (version 2.1.1)

After dify1.0.1 successfully started the docker container, I stopped the API server, Worker and Web frontend Server. then completing poetry install, I executed poetry run flask db upgrade:
Traceback (most recent call last): ... File "E:\dify\api\.venv\Lib\site-packages\psycopg2\__init__.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 61: invalid continuation byte

I had reported the following error before:
psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
Then I installed psql on the Windows host and executed
vi /var/lib/postgresql/data/pgdata/pg_hba.conf on the api container
Added:
host all all 0.0.0.0/0 md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
Then it became
Traceback (most recent call last): ... File "E:\dify\api\.venv\Lib\site-packages\psycopg2\__init__.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 61: invalid continuation byte

✔️ Expected Behavior

Successfully deployed Source Code deployments

Actual Behavior

poetry run flask db upgrade fails

Originally created by @dennischan7 on GitHub (Mar 12, 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 1.0.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Python 3.12.6 Poetry (version 2.1.1) After dify1.0.1 successfully started the docker container, I stopped the API server, Worker and Web frontend Server. then completing poetry install, I executed poetry run flask db upgrade: `Traceback (most recent call last): ... File "E:\dify\api\.venv\Lib\site-packages\psycopg2\__init__.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 61: invalid continuation byte ` I had reported the following error before: psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061) Is the server running on that host and accepting TCP/IP connections? Then I installed psql on the Windows host and executed vi /var/lib/postgresql/data/pgdata/pg_hba.conf on the api container Added: host all all 0.0.0.0/0 md5 host all all 127.0.0.1/32 md5 host all all ::1/128 md5 Then it became `Traceback (most recent call last): ... File "E:\dify\api\.venv\Lib\site-packages\psycopg2\__init__.py", line 122, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 61: invalid continuation byte ` ### ✔️ Expected Behavior Successfully deployed Source Code deployments ### ❌ Actual Behavior poetry run flask db upgrade fails
yindo added the 🐞 bug label 2026-02-21 18:48:47 -05:00
yindo closed this issue 2026-02-21 18:48:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#10589