dify-web got Invalid languages error #6372

Closed
opened 2026-02-21 18:15:27 -05:00 by yindo · 1 comment
Owner

Originally created by @seikyo-cho-lvgs on GitHub (Oct 28, 2024).

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.10.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I deploy dify on Kubernetes with helm chart. This error always happen in the dify-web pod:

01:00:10 1|dify-web  | Invalid languages: *
01:00:10 1|dify-web  | Invalid languages: *
01:00:10 1|dify-web  | Invalid languages: *

I can find the locale cookie is en in the browser cache.
But it got * in frontend application.

Source:

https://github.com/langgenius/dify/blob/b674c598f98b9dde18e418a9fa5b8253c6bc4062/web/i18n/server.ts#L41-L53

✔️ Expected Behavior

No error.

Actual Behavior

The error happened every minute.

Originally created by @seikyo-cho-lvgs on GitHub (Oct 28, 2024). ### 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.10.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I deploy dify on Kubernetes with [helm chart](https://github.com/douban/charts/tree/master/charts/dify). This error always happen in the dify-web pod: ``` 01:00:10 1|dify-web | Invalid languages: * 01:00:10 1|dify-web | Invalid languages: * 01:00:10 1|dify-web | Invalid languages: * ``` I can find the locale cookie is en in the browser cache. But it got * in frontend application. Source: https://github.com/langgenius/dify/blob/b674c598f98b9dde18e418a9fa5b8253c6bc4062/web/i18n/server.ts#L41-L53 ### ✔️ Expected Behavior No error. ### ❌ Actual Behavior The error happened every minute.
yindo added the 🐞 bug label 2026-02-21 18:15:27 -05:00
yindo closed this issue 2026-02-21 18:15:27 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 28, 2024):

I found a similar unsolved discussion regarding the "Invalid languages" error in the Dify repository. You can check it out here: dify-web got Invalid languages error [1].

Regarding the issue you're facing, the error message "Invalid languages: " suggests that the languages array is being populated with an invalid entry, specifically the '' character. This typically happens when the locale is not correctly set or recognized.

Here are a few things you might want to check:

  1. Locale Cookie: Ensure that the locale cookie is correctly set to a valid language code. The expected format should match one of the supported languages, such as en-US or zh-Hans [2].

  2. Helm Chart Configuration: Verify the i18n.locale setting in your Helm chart configuration. It should be set to a supported language, like en or zh-CN [3].

  3. Server Code: In the server.ts file, the languages array is populated from cookies and request headers. If the locale is not correctly set in the cookie, the Negotiator library will attempt to determine the preferred languages from the request headers. Ensure that the headers are correctly configured and that the Negotiator is functioning as expected [4].

By addressing these areas, you should be able to resolve the "Invalid languages" error. If the issue persists, further investigation into the server-side handling of locales might be necessary.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 28, 2024): <!-- Answer --> I found a similar unsolved discussion regarding the "Invalid languages" error in the Dify repository. You can check it out here: [dify-web got Invalid languages error](https://github.com/langgenius/dify/discussions/9779) <sup>[[1]](https://github.com/langgenius/dify/discussions/9779)</sup>. Regarding the issue you're facing, the error message "Invalid languages: *" suggests that the `languages` array is being populated with an invalid entry, specifically the '*' character. This typically happens when the locale is not correctly set or recognized. Here are a few things you might want to check: 1. **Locale Cookie**: Ensure that the locale cookie is correctly set to a valid language code. The expected format should match one of the supported languages, such as `en-US` or `zh-Hans` <sup>[[2]](https://github.com/langgenius/dify/blob/main/web/i18n/index.ts)</sup>. 2. **Helm Chart Configuration**: Verify the `i18n.locale` setting in your Helm chart configuration. It should be set to a supported language, like `en` or `zh-CN` <sup>[[3]](https://github.com/langgenius/dify/blob/main/docker/volumes/opensearch/opensearch_dashboards.yml)</sup>. 3. **Server Code**: In the `server.ts` file, the `languages` array is populated from cookies and request headers. If the locale is not correctly set in the cookie, the `Negotiator` library will attempt to determine the preferred languages from the request headers. Ensure that the headers are correctly configured and that the `Negotiator` is functioning as expected <sup>[[4]](https://github.com/langgenius/dify/blob/main/web/i18n/server.ts)</sup>. By addressing these areas, you should be able to resolve the "Invalid languages" error. If the issue persists, further investigation into the server-side handling of locales might be necessary. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6372