LOG_TZ ValidationError #6443

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

Originally created by @mayiming0708 on GitHub (Oct 30, 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

bab5c54219

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

start and visit, if I revert this commit(bab5c54219),it will be ok

✔️ Expected Behavior

No response

Actual Behavior

Traceback (most recent call last):
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 948, in app
raise err from None
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/werkzeug/debug/__init__.py", line 342, in debug_application
app_iter = self.app(environ, start_response)
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 948, in app
raise err from None
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 937, in run_command
app: WSGIApplication = info.load_app()
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 339, in load_app
app = locate_app(import_name, None, raise_if_not_found=False)
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 245, in locate_app
import(module_name)
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/app.py", line 3, in
from configs import dify_config
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/configs/__init__.py", line 3, in
dify_config = DifyConfig()
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/pydantic_settings/main.py", line 167, in init
super().init(
File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/pydantic/main.py", line 212, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for DifyConfig
LOG_TZ
String should have at least 1 character [type=string_too_short, input_value='', input_type=str]
For further information visit https://errors.pydantic.dev/2.9/v/string_too_short

Originally created by @mayiming0708 on GitHub (Oct 30, 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 bab5c542197f935d35fe75eb5d2c3301fbbf58b4 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce start and visit, if I revert this commit(bab5c542197f935d35fe75eb5d2c3301fbbf58b4),it will be ok ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior Traceback (most recent call last): File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 948, in app raise err from None File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/werkzeug/debug/__init__.py", line 342, in debug_application app_iter = self.app(environ, start_response) File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 948, in app raise err from None File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 937, in run_command app: WSGIApplication = info.load_app() File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 339, in load_app app = locate_app(import_name, None, raise_if_not_found=False) File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/flask/cli.py", line 245, in locate_app __import__(module_name) File "/Users/antk/Documents/code/github.com/langgenius/dify/api/app.py", line 3, in <module> from configs import dify_config File "/Users/antk/Documents/code/github.com/langgenius/dify/api/configs/__init__.py", line 3, in <module> dify_config = DifyConfig() File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/pydantic_settings/main.py", line 167, in __init__ super().__init__( File "/Users/antk/Documents/code/github.com/langgenius/dify/api/.venv/lib/python3.10/site-packages/pydantic/main.py", line 212, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for DifyConfig LOG_TZ String should have at least 1 character [type=string_too_short, input_value='', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/string_too_short
yindo added the 🐞 bug label 2026-02-21 18:15:46 -05:00
yindo closed this issue 2026-02-21 18:15:46 -05:00
Author
Owner

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

Hey @mayiming0708! I'm here to help you with any bugs, questions, or contributions you have for the project. Let's tackle this together!

It seems like you're encountering a ValidationError related to the LOG_TZ configuration in the DifyConfig class. The error indicates that the LOG_TZ field is expected to have at least one character, but it appears to be an empty string.

The LOG_TZ configuration is used to set the timezone for log timestamps, and it should be a valid timezone name according to the IANA Time Zone Database, such as 'America/New_York' [1][2].

To resolve this issue, ensure that the LOG_TZ field in your configuration is set to a valid timezone string. If you don't need to specify a timezone, you can set it to None, which will use the system's default timezone.

If the issue persists after setting a valid timezone, it might be related to changes introduced in the commit bab5c542197f935d35fe75eb5d2c3301fbbf58b4. Unfortunately, I don't have specific details on what changes were made in that commit, but reverting it seems to resolve the issue according to your description. You might want to review the changes in that commit to understand how it affects the LOG_TZ validation.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 30, 2024): <!-- Greeting --> Hey @mayiming0708! I'm here to help you with any bugs, questions, or contributions you have for the project. Let's tackle this together! <!-- Answer --> It seems like you're encountering a `ValidationError` related to the `LOG_TZ` configuration in the `DifyConfig` class. The error indicates that the `LOG_TZ` field is expected to have at least one character, but it appears to be an empty string. The `LOG_TZ` configuration is used to set the timezone for log timestamps, and it should be a valid timezone name according to the IANA Time Zone Database, such as 'America/New_York' <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/configs/feature/__init__.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/extensions/ext_logging.py)</sup>. To resolve this issue, ensure that the `LOG_TZ` field in your configuration is set to a valid timezone string. If you don't need to specify a timezone, you can set it to `None`, which will use the system's default timezone. If the issue persists after setting a valid timezone, it might be related to changes introduced in the commit `bab5c542197f935d35fe75eb5d2c3301fbbf58b4`. Unfortunately, I don't have specific details on what changes were made in that commit, but reverting it seems to resolve the issue according to your description. You might want to review the changes in that commit to understand how it affects the `LOG_TZ` validation. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@mayiming0708 commented on GitHub (Oct 30, 2024):

LOG_TZ use default config None

@mayiming0708 commented on GitHub (Oct 30, 2024): LOG_TZ use default config `None`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6443