diff --git a/astrbot/core/config/astrbot_config.py b/astrbot/core/config/astrbot_config.py index 4d62becb55..5f4e19e40f 100644 --- a/astrbot/core/config/astrbot_config.py +++ b/astrbot/core/config/astrbot_config.py @@ -62,7 +62,13 @@ def __init__( # Handle UTF-8 BOM if present if conf_str.startswith("\ufeff"): conf_str = conf_str[1:] - conf = json.loads(conf_str) + if not conf_str: + raise EnvironmentError(f'文件 {config_path} 为空, 请手动处理...') + try: + conf = json.loads(conf_str) + except Exception as e: + logger.error(f'读取文件失败 {config_path}: {e}') + raise e dashboard_conf = conf.get("dashboard") legacy_dashboard_password_change_required = bool( isinstance(dashboard_conf, dict)