UnicodeEncodeError 'latin-1' codec can't encode characters in position 43-49: ordinal not in range(256) #15516

Closed
opened 2026-02-21 19:22:05 -05:00 by yindo · 2 comments
Owner

Originally created by @rongerwhiter on GitHub (Jul 20, 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

1.6.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1.Install TONGYI Model Provider
2.Setup API-KEY
3.CREATE APP
4.Debug & Preview

✔️ Expected Behavior

Message

Actual Behavior

[tongyi] Error: PluginInvokeError: {"args":{},"error_type":"UnicodeEncodeError","message":"'latin-1' codec can't encode characters in position 43-49: ordinal not in range(256)"}
Image

Originally created by @rongerwhiter on GitHub (Jul 20, 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 1.6.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1.Install TONGYI Model Provider 2.Setup API-KEY 3.CREATE APP 4.Debug & Preview ### ✔️ Expected Behavior Message ### ❌ Actual Behavior [tongyi] Error: PluginInvokeError: {"args":{},"error_type":"UnicodeEncodeError","message":"'latin-1' codec can't encode characters in position 43-49: ordinal not in range(256)"} <img width="1709" height="942" alt="Image" src="https://github.com/user-attachments/assets/cda77ff0-9d03-48fc-8404-8d72db8f8247" />
yindo added the 🐞 bug label 2026-02-21 19:22:05 -05:00
yindo closed this issue 2026-02-21 19:22:05 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 20, 2025):

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

This error is most likely caused by a locale or encoding mismatch in your Docker environment or an external process used by the TONGYI provider. Dify itself uses UTF-8 encoding throughout its codebase and does not enforce 'latin-1' anywhere in production logic, so the issue is probably environmental or in a plugin daemon, not in Dify's core code [source].

To resolve this, check that your Docker container and any plugin daemons have environment variables like LANG, LC_ALL, and PYTHONIOENCODING set to use UTF-8 (for example, en_US.UTF-8). You can set these in your Dockerfile or docker-compose file. If you have access to the payload or data that triggers the error, sharing it could help pinpoint the problematic characters.

Recent updates in Dify reinforce UTF-8 as the standard encoding, so this kind of error usually points to a misconfigured environment or external dependency [source].

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Jul 20, 2025): <!-- Greeting --> Hi @rongerwhiter! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This error is most likely caused by a locale or encoding mismatch in your Docker environment or an external process used by the TONGYI provider. Dify itself uses UTF-8 encoding throughout its codebase and does not enforce 'latin-1' anywhere in production logic, so the issue is probably environmental or in a plugin daemon, not in Dify's core code [[source]](https://github.com/langgenius/dify/blob/383a79772c225a66332fbcd3ee16858195dac088/api/core/plugin/backwards_invocation/base.py). To resolve this, check that your Docker container and any plugin daemons have environment variables like `LANG`, `LC_ALL`, and `PYTHONIOENCODING` set to use UTF-8 (for example, `en_US.UTF-8`). You can set these in your Dockerfile or docker-compose file. If you have access to the payload or data that triggers the error, sharing it could help pinpoint the problematic characters. Recent updates in Dify reinforce UTF-8 as the standard encoding, so this kind of error usually points to a misconfigured environment or external dependency [[source]](https://github.com/langgenius/dify/pull/19023). <!-- 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/8c7fcf0b-dd94-49d6-9200-f30de33aa892?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/8c7fcf0b-dd94-49d6-9200-f30de33aa892?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/8c7fcf0b-dd94-49d6-9200-f30de33aa892?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/8c7fcf0b-dd94-49d6-9200-f30de33aa892?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8c7fcf0b-dd94-49d6-9200-f30de33aa892?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/8c7fcf0b-dd94-49d6-9200-f30de33aa892?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8c7fcf0b-dd94-49d6-9200-f30de33aa892?feedback_type=other)</sup>&nbsp;&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/22689)
Author
Owner

@jubinsoni commented on GitHub (Jul 24, 2025):

generated docker/docker-compose.yaml automatically by following below steps

cd docker
chmod +x generate_docker_compose
./generate_docker_compose

@rongerwhiter @crazywoola pls review
https://github.com/langgenius/dify/pull/22928

@jubinsoni commented on GitHub (Jul 24, 2025): generated docker/docker-compose.yaml automatically by following below steps cd docker chmod +x generate_docker_compose ./generate_docker_compose @rongerwhiter @crazywoola pls review https://github.com/langgenius/dify/pull/22928
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15516