{"record":{"id":"65e91d04dba9223d","repo":"XX-net/XX-Net","slug":"loading-config-e-r","errorCode":null,"errorMessage":"loading config e:%r","messagePattern":"loading config e:%r","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/launcher/config.py","lineNumber":88,"sourceCode":"config.set_var(\"enable_launcher\", 1)\nconfig.set_var(\"enable_x_tunnel\", 1)\nconfig.set_var(\"enable_gae_proxy\", 0)\nconfig.set_var(\"enable_smart_router\", 1)\n\nconfig.set_var(\"os_proxy_mode\", \"pac\") # can be: gae, x_tunnel, smart_router, disable\n\n# Proxy\nconfig.set_var(\"global_proxy_enable\", 0)\nconfig.set_var(\"global_proxy_type\", \"HTTP\") # can be: HTTP/ SOCKS4/ SOCKs5\nconfig.set_var(\"global_proxy_host\", \"\")\nconfig.set_var(\"global_proxy_port\", 0)\nconfig.set_var(\"global_proxy_username\", \"\")\nconfig.set_var(\"global_proxy_password\", \"\")\n\ntry:\n    config.load()\nexcept Exception as e:\n    xlog.warn(\"loading config e:%r\", e)\n\napp_name = \"XX-Net\"\nvalid_language = ['en_US', 'fa_IR', 'zh_CN', 'ru_RU']\ntry:\n    fp = os.path.join(root_path, \"code\", \"app_info.json\")\n    with open(fp, \"r\") as fd:\n        app_info = json.load(fd)\n        app_name = app_info[\"app_name\"]\nexcept Exception as e:\n    print(\"load app_info except:\", e)\n    pass\n\n\ndef _get_os_language():\n\n    if sys_platform.platform == \"mac\":\n        try:\n            lang_code = subprocess.check_output([\"/usr/bin/defaults\", 'read', 'NSGlobalDomain', 'AppleLanguages'])","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/config.py#L70-L106","documentation":"The launcher could not load its configuration file; config.load() raised an exception. This is a non-fatal warning — the process continues with default variable values, so behavior may differ from the user's saved settings.","triggerScenarios":"config.load() encountering a missing, unreadable, or corrupted config file (bad JSON/YAML, truncated write, permission denied) at startup of the launcher module.","commonSituations":"Config file corrupted by an unclean shutdown, edited by hand with a syntax error, first run with no config file, or file owned by a different user/root after running with sudo.","solutions":["Check the config file location and validate its syntax (JSON parse) manually","Restore from backup or delete the corrupted file to let the launcher regenerate defaults","Fix ownership/permissions if the process cannot read the file (e.g. after sudo runs)","Ensure the process is not interrupted while it saves config to avoid truncated files"],"exampleFix":"// before\ntry:\n    config.load()\nexcept Exception as e:\n    xlog.warn(\"loading config e:%r\", e)\n// after\ntry:\n    config.load()\nexcept Exception as e:\n    xlog.warn(\"loading config e:%r\", e)\n    xlog.warn(\"regenerating default config\")\n    config.save()","handlingStrategy":"try-catch","validationCode":"import json, os\np = config_file_path\nif not os.path.exists(p) or not _is_valid_json(p):\n    # back up and let app regenerate defaults\n","typeGuard":null,"tryCatchPattern":"try:\n    config.load()\nexcept Exception as e:\n    xlog.warn(\"loading config e:%r\", e)\n    # keep running with defaults; optionally back up the bad file","preventionTips":["Write config atomically (write temp file + os.replace) to avoid truncation","Validate config edits with a JSON linter before saving","Keep a known-good backup of config files"],"tags":["config","startup","io","corruption"],"backgroundTag":"config-file-load-failed","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}