RangeError: Incorrect locale information provided #7960

Closed
opened 2026-02-21 18:23:15 -05:00 by yindo · 14 comments
Owner

Originally created by @Kingong on GitHub (Feb 3, 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.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I use the 0.15.2 version dify to self-hosted deploy. when i access in the browser, the dify-web occurs error:

23:57:48 0|dify-web  | RangeError: Incorrect locale information provided
23:57:48 0|dify-web  |     at Intl.getCanonicalLocales (<anonymous>)
23:57:48 0|dify-web  |     at p (/app/web/.next/server/chunks/10211.js:30:45891)
23:57:48 0|dify-web  |     at g (/app/web/.next/server/chunks/89316.js:131:76494)
23:57:48 0|dify-web  |     at g (/app/web/.next/server/chunks/89316.js:131:67556)
23:57:48 0|dify-web  |     at eh (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:134657)
23:57:48 0|dify-web  |     at e (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:137542)
23:57:48 0|dify-web  |     at ek (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:138016)
23:57:48 0|dify-web  |     at Array.toJSON (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135626)
23:57:48 0|dify-web  |     at stringify (<anonymous>)
23:57:48 0|dify-web  |     at eP (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:142090) {
23:57:48 0|dify-web  |   digest: '1502580954'

I has checked the similar issues to resolve, but it is not work. please help me!!! Thanks.

✔️ Expected Behavior

The dify self-hosted can access correctly.

Actual Behavior

dify-web occurs error "RangeError: Incorrect locale information provided"

Originally created by @Kingong on GitHub (Feb 3, 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.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I use the 0.15.2 version dify to self-hosted deploy. when i access in the browser, the dify-web occurs error: ``` 23:57:48 0|dify-web | RangeError: Incorrect locale information provided 23:57:48 0|dify-web | at Intl.getCanonicalLocales (<anonymous>) 23:57:48 0|dify-web | at p (/app/web/.next/server/chunks/10211.js:30:45891) 23:57:48 0|dify-web | at g (/app/web/.next/server/chunks/89316.js:131:76494) 23:57:48 0|dify-web | at g (/app/web/.next/server/chunks/89316.js:131:67556) 23:57:48 0|dify-web | at eh (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:134657) 23:57:48 0|dify-web | at e (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:137542) 23:57:48 0|dify-web | at ek (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:138016) 23:57:48 0|dify-web | at Array.toJSON (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:135626) 23:57:48 0|dify-web | at stringify (<anonymous>) 23:57:48 0|dify-web | at eP (/app/web/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:142090) { 23:57:48 0|dify-web | digest: '1502580954' ``` I has checked the similar issues to resolve, but it is not work. please help me!!! Thanks. ### ✔️ Expected Behavior The dify self-hosted can access correctly. ### ❌ Actual Behavior dify-web occurs error "RangeError: Incorrect locale information provided"
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 18:23:15 -05:00
yindo closed this issue 2026-02-21 18:23:15 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 3, 2025):

Hello @Kingong! I'm here to help you with bug fixes, answer your questions, and guide you on how to become a contributor. Let's work together to resolve the issue you're facing.

I found a similar issue that might help you resolve the "RangeError: Incorrect locale information provided" error in your self-hosted Dify version 0.15.2. The solution involves checking the web/i18n/languages.json file for any inconsistencies or unsupported locales. Specifically, ensure that the supported field is a boolean value (true or false) rather than a string. For example, entries for "Hindi (India)" and "Türkçe" should have "supported": true as a boolean instead of a string.

Here's how you can correct these entries:

{
  "value": "hi-IN",
  "name": "Hindi (India)",
  "prompt_name": "Hindi",
  "example": "नमस्ते, Dify!",
  "supported": true
},
{
  "value": "tr-TR",
  "name": "Türkçe",
  "prompt_name": "Türkçe",
  "example": "Selam!",
  "supported": true
}

After making these corrections, try accessing the application again to see if the error is resolved [1].

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Feb 3, 2025): <!-- Greeting --> Hello @Kingong! I'm here to help you with bug fixes, answer your questions, and guide you on how to become a contributor. Let's work together to resolve the issue you're facing. <!-- Answer --> I found a similar issue that might help you resolve the "RangeError: Incorrect locale information provided" error in your self-hosted Dify version 0.15.2. The solution involves checking the `web/i18n/languages.json` file for any inconsistencies or unsupported locales. Specifically, ensure that the `supported` field is a boolean value (`true` or `false`) rather than a string. For example, entries for "Hindi (India)" and "Türkçe" should have `"supported": true` as a boolean instead of a string. Here's how you can correct these entries: ```json { "value": "hi-IN", "name": "Hindi (India)", "prompt_name": "Hindi", "example": "नमस्ते, Dify!", "supported": true }, { "value": "tr-TR", "name": "Türkçe", "prompt_name": "Türkçe", "example": "Selam!", "supported": true } ``` After making these corrections, try accessing the application again to see if the error is resolved <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/i18n/languages.json)</sup>. <!-- 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/5a87dc7f-b858-41f2-b141-5248c8ae4d7b?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/5a87dc7f-b858-41f2-b141-5248c8ae4d7b?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/5a87dc7f-b858-41f2-b141-5248c8ae4d7b?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/5a87dc7f-b858-41f2-b141-5248c8ae4d7b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/5a87dc7f-b858-41f2-b141-5248c8ae4d7b?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/5a87dc7f-b858-41f2-b141-5248c8ae4d7b?feedback_type=other)</sup>
Author
Owner

@Kingong commented on GitHub (Feb 3, 2025):

i enter dify-web container, the LANG value is zh_CN.UTF-8

@Kingong commented on GitHub (Feb 3, 2025): i enter dify-web container, the `LANG` value is `zh_CN.UTF-8`
Author
Owner

@Kingong commented on GitHub (Feb 3, 2025):

@dosu

@Kingong commented on GitHub (Feb 3, 2025): @dosu
Author
Owner

@dosubot[bot] commented on GitHub (Feb 3, 2025):

The LANG environment variable set to zh_CN.UTF-8 in the Dify-web container might be causing the locale-related error. To resolve this, you can try changing the LANG environment variable to en_US.UTF-8 or another supported locale. Here's how you can do it:

  1. Enter the Dify-web container:

    docker exec -it <container_id> /bin/bash
    
  2. Update the LANG environment variable:

    export LANG=en_US.UTF-8
    
  3. Restart the application within the container or restart the container itself to apply the changes.

This change should help align the locale settings with the default locale configuration in Dify, which is en-US [1].

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Feb 3, 2025): <!-- Answer --> The `LANG` environment variable set to `zh_CN.UTF-8` in the Dify-web container might be causing the locale-related error. To resolve this, you can try changing the `LANG` environment variable to `en_US.UTF-8` or another supported locale. Here's how you can do it: 1. Enter the Dify-web container: ```bash docker exec -it <container_id> /bin/bash ``` 2. Update the `LANG` environment variable: ```bash export LANG=en_US.UTF-8 ``` 3. Restart the application within the container or restart the container itself to apply the changes. This change should help align the locale settings with the default locale configuration in Dify, which is `en-US` <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/i18n/README.md)</sup>. <!-- 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/801da5de-ceac-4944-940c-971d6f5c9236?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/801da5de-ceac-4944-940c-971d6f5c9236?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/801da5de-ceac-4944-940c-971d6f5c9236?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/801da5de-ceac-4944-940c-971d6f5c9236?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/801da5de-ceac-4944-940c-971d6f5c9236?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/801da5de-ceac-4944-940c-971d6f5c9236?feedback_type=other)</sup>
Author
Owner

@Kingong commented on GitHub (Feb 4, 2025):

i set the LANG、LC_ALL、LANGUAGE,but it is not works. still bug

Image

Image

@Kingong commented on GitHub (Feb 4, 2025): i set the LANG、LC_ALL、LANGUAGE,but it is not works. still bug ![Image](https://github.com/user-attachments/assets/12d92e28-7022-44e1-b841-65c0e7d58682) ![Image](https://github.com/user-attachments/assets/6ffdc313-56de-4de6-8b86-1039b3a97d79)
Author
Owner

@Kingong commented on GitHub (Feb 4, 2025):

@dosu

@Kingong commented on GitHub (Feb 4, 2025): @dosu
Author
Owner

@dosubot[bot] commented on GitHub (Feb 4, 2025):

If setting the LANG, LC_ALL, and LANGUAGE environment variables to en_US.UTF-8 did not resolve the issue, the problem might be related to how locales are being handled within the application code or dependencies. Here are a few steps you can take to further diagnose and potentially resolve the issue:

  1. Check Locale Configuration in Code: Ensure that the locale settings in your application code are correctly configured. Verify that the web/i18n/languages.json file does not contain any unsupported or incorrectly formatted locale entries. All supported fields should be boolean values [1].

  2. Dependencies and Compatibility: Ensure that all dependencies related to internationalization are up to date and compatible. The Dify application uses @formatjs/intl-localematcher, i18next, and react-i18next for locale handling. Check if there are any known issues with these versions that might affect locale handling [2].

  3. Locale Fallback: Implement a fallback mechanism in your code to handle cases where the provided locale is not supported. This can prevent the application from crashing due to unsupported locale information.

  4. Debugging: Add logging around the parts of your code where Intl.getCanonicalLocales is used to capture the exact locale values being passed. This can help identify if there are any unexpected values causing the error.

  5. Rebuild the Container: After making changes, ensure that you rebuild the Docker container to apply the updates. Sometimes, changes to environment variables or code require a full rebuild to take effect.

If these steps do not resolve the issue, consider reviewing the specific parts of the code where Intl.getCanonicalLocales is invoked to ensure that the input is valid and supported.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Feb 4, 2025): <!-- Answer --> If setting the `LANG`, `LC_ALL`, and `LANGUAGE` environment variables to `en_US.UTF-8` did not resolve the issue, the problem might be related to how locales are being handled within the application code or dependencies. Here are a few steps you can take to further diagnose and potentially resolve the issue: 1. **Check Locale Configuration in Code**: Ensure that the locale settings in your application code are correctly configured. Verify that the `web/i18n/languages.json` file does not contain any unsupported or incorrectly formatted locale entries. All `supported` fields should be boolean values <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/i18n/languages.json)</sup>. 2. **Dependencies and Compatibility**: Ensure that all dependencies related to internationalization are up to date and compatible. The Dify application uses `@formatjs/intl-localematcher`, `i18next`, and `react-i18next` for locale handling. Check if there are any known issues with these versions that might affect locale handling <sup>[[2]](https://github.com/langgenius/dify/blob/main/web/package.json)</sup>. 3. **Locale Fallback**: Implement a fallback mechanism in your code to handle cases where the provided locale is not supported. This can prevent the application from crashing due to unsupported locale information. 4. **Debugging**: Add logging around the parts of your code where `Intl.getCanonicalLocales` is used to capture the exact locale values being passed. This can help identify if there are any unexpected values causing the error. 5. **Rebuild the Container**: After making changes, ensure that you rebuild the Docker container to apply the updates. Sometimes, changes to environment variables or code require a full rebuild to take effect. If these steps do not resolve the issue, consider reviewing the specific parts of the code where `Intl.getCanonicalLocales` is invoked to ensure that the input is valid and supported. <!-- 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/e0b58a95-8709-4fd8-919c-cf8d1aae49d1?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/e0b58a95-8709-4fd8-919c-cf8d1aae49d1?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/e0b58a95-8709-4fd8-919c-cf8d1aae49d1?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/e0b58a95-8709-4fd8-919c-cf8d1aae49d1?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e0b58a95-8709-4fd8-919c-cf8d1aae49d1?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/e0b58a95-8709-4fd8-919c-cf8d1aae49d1?feedback_type=other)</sup>
Author
Owner

@Kingong commented on GitHub (Feb 4, 2025):

still bugs, please tell me what should i do

@Kingong commented on GitHub (Feb 4, 2025): still bugs, please tell me what should i do
Author
Owner

@Kingong commented on GitHub (Feb 4, 2025):

@dosu

@Kingong commented on GitHub (Feb 4, 2025): @dosu
Author
Owner

@dosubot[bot] commented on GitHub (Feb 4, 2025):

To address the persistent "RangeError: Incorrect locale information provided" issue, consider the following steps:

  1. Verify Locale Inputs: Ensure that the inputs to Intl.getCanonicalLocales are valid. Add logging around this function to capture the exact values being passed. This can help identify any unexpected or malformed locale strings.

  2. Check for Hardcoded Locales: Review your codebase for any hardcoded locale values that might not be supported. Ensure that all locale values are dynamically retrieved from a validated source, such as the languages.json file.

  3. Update Dependencies: Make sure all internationalization-related dependencies (@formatjs/intl-localematcher, i18next, react-i18next) are up to date. Check their documentation for any known issues or updates that might address locale handling problems.

  4. Implement Fallbacks: Introduce a fallback mechanism in your application to handle unsupported locales gracefully. This can prevent the application from crashing when an unsupported locale is encountered.

  5. Rebuild Docker Container: After making any changes, rebuild your Docker container to ensure all updates are applied. Follow these steps:

    • Stop and remove existing containers and volumes:
      docker compose down -v
      
    • Pull the latest code and images:
      git pull origin main
      docker compose pull
      
    • Rebuild without cache and start the containers:
      docker compose build --no-cache
      docker compose up --force-recreate --detach
      
  6. Locale Environment Variables: Double-check that the locale environment variables (LANG, LC_ALL, LANGUAGE) are correctly set in your Dockerfile or Docker Compose configuration, and ensure they persist across container restarts.

By following these steps, you should be able to identify and resolve the locale-related error. If the issue persists, further investigation into the specific code paths and inputs to Intl.getCanonicalLocales may be necessary.

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Feb 4, 2025): <!-- Answer --> To address the persistent "RangeError: Incorrect locale information provided" issue, consider the following steps: 1. **Verify Locale Inputs**: Ensure that the inputs to `Intl.getCanonicalLocales` are valid. Add logging around this function to capture the exact values being passed. This can help identify any unexpected or malformed locale strings. 2. **Check for Hardcoded Locales**: Review your codebase for any hardcoded locale values that might not be supported. Ensure that all locale values are dynamically retrieved from a validated source, such as the `languages.json` file. 3. **Update Dependencies**: Make sure all internationalization-related dependencies (`@formatjs/intl-localematcher`, `i18next`, `react-i18next`) are up to date. Check their documentation for any known issues or updates that might address locale handling problems. 4. **Implement Fallbacks**: Introduce a fallback mechanism in your application to handle unsupported locales gracefully. This can prevent the application from crashing when an unsupported locale is encountered. 5. **Rebuild Docker Container**: After making any changes, rebuild your Docker container to ensure all updates are applied. Follow these steps: - Stop and remove existing containers and volumes: ```bash docker compose down -v ``` - Pull the latest code and images: ```bash git pull origin main docker compose pull ``` - Rebuild without cache and start the containers: ```bash docker compose build --no-cache docker compose up --force-recreate --detach ``` 6. **Locale Environment Variables**: Double-check that the locale environment variables (`LANG`, `LC_ALL`, `LANGUAGE`) are correctly set in your Dockerfile or Docker Compose configuration, and ensure they persist across container restarts. By following these steps, you should be able to identify and resolve the locale-related error. If the issue persists, further investigation into the specific code paths and inputs to `Intl.getCanonicalLocales` may be necessary. <!-- 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/354aea55-158c-4df2-938f-1bd83c420b9c?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/354aea55-158c-4df2-938f-1bd83c420b9c?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/354aea55-158c-4df2-938f-1bd83c420b9c?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/354aea55-158c-4df2-938f-1bd83c420b9c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/354aea55-158c-4df2-938f-1bd83c420b9c?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/354aea55-158c-4df2-938f-1bd83c420b9c?feedback_type=other)</sup>
Author
Owner

@Kingong commented on GitHub (Feb 4, 2025):

Thanks. i have resolved this problem by reset domain 和 other configs

@Kingong commented on GitHub (Feb 4, 2025): Thanks. i have resolved this problem by reset domain 和 other configs
Author
Owner

@tangdw commented on GitHub (Feb 14, 2025):

谢谢。我已通过重置域名和其他配置解决了这个问题

可以详细说说怎么解决的吗?这里都是机器人在回答

@tangdw commented on GitHub (Feb 14, 2025): > 谢谢。我已通过重置域名和其他配置解决了这个问题 可以详细说说怎么解决的吗?这里都是机器人在回答
Author
Owner

@BreakthrougBackEndTech commented on GitHub (Feb 25, 2025):

Could you please elaborate on how it was solved? I can't slove it after set LANG, LC_ALL, and LANGUAGE environment variables to en_US.UTF-8

@BreakthrougBackEndTech commented on GitHub (Feb 25, 2025): Could you please elaborate on how it was solved? I can't slove it after set LANG, LC_ALL, and LANGUAGE environment variables to en_US.UTF-8
Author
Owner

@lingqiao123 commented on GitHub (May 12, 2025):

我这边出现的是有的人会出现,有的人不会,清除缓存之后就好了,这是为什么?

@lingqiao123 commented on GitHub (May 12, 2025): 我这边出现的是有的人会出现,有的人不会,清除缓存之后就好了,这是为什么?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7960