{"record":{"id":"54d48c4306bd5dd3","repo":"XX-net/XX-Net","slug":"render-s-except-r","errorCode":null,"errorMessage":"render %s except:%r","messagePattern":"render (.+?) except:%r","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"code/default/launcher/web_control.py","lineNumber":366,"sourceCode":"            #     target_module = 'smart_router'\n            #     target_menu = 'config'\n            elif config.enable_gae_proxy:\n                target_module = 'gae_proxy'\n                target_menu = 'status'\n            else:\n                target_module = 'launcher'\n                target_menu = 'about'\n\n        if len(module_menus) == 0:\n            self.load_module_menus()\n\n        # i18n code lines (Both the locale dir & the template dir are module-dependent)\n        locale_dir = os.path.abspath(os.path.join(current_path, 'lang'))\n        fn = os.path.join(current_path, \"web_ui\", \"index.html\")\n        try:\n            index_content = i18n_translator.render(locale_dir, fn)\n        except Exception as e:\n            xlog.warn(\"render %s except:%r\", fn, e)\n            return self.send_not_found()\n\n        menu_content = b''\n        for module, v in module_menus:\n            # xlog.debug(\"m:%s id:%d\", module, v['menu_sort_id'])\n            title = v[\"module_title\"]\n            menu_content += b'<li class=\"nav-header\">%s</li>\\n' % utils.to_bytes(title)\n            for sub_id in v['sub_menus']:\n                list_meta = b''\n                web_id = v['sub_menus'][sub_id].get(\"id\")\n                if web_id:\n                    list_meta += b' id=\"%s\"' % sub_id\n\n                sub_title = v['sub_menus'][sub_id]['title']\n                if \"url\" in v['sub_menus'][sub_id]:\n                    sub_url = v['sub_menus'][sub_id]['url']\n                    if target_module == module and target_menu == sub_url:\n                        list_meta += b'class=\"active\"'","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/web_control.py#L348-L384","documentation":"Rendering the index page through i18n_translator.render(locale_dir, index.html) raised; the handler logs it and returns 404, so the main UI fails to load.","triggerScenarios":"Missing/corrupt web_ui/index.html, unreadable lang/ directory, bad template syntax, or an i18n/encoding error in the translator.","commonSituations":"Incomplete install or failed update leaving index.html absent; permission issues in the launcher dir; locale files with invalid escape sequences after manual editing.","solutions":["Confirm code/default/launcher/web_ui/index.html exists and is readable.","Restore lang/ and templates from a fresh download of the same version.","Check the log's %r exception for the precise template/i18n cause.","Reinstall/repair the installation if files are corrupt."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import os\nfn = os.path.join(current_path,'web_ui','index.html')\nif not os.path.isfile(fn) or not os.access(fn, os.R_OK):\n    return send_not_found()","typeGuard":null,"tryCatchPattern":"try:\n    content = i18n_translator.render(locale_dir, fn)\nexcept Exception:\n    log.exception('render failed for %s', fn)\n    return send_not_found()","preventionTips":["Keep web_ui/ and lang/ intact after updates.","Validate edited locale files (escapes, UTF-8).","Repair install from a clean archive when templates break."],"tags":["i18n","template","web-ui","rendering"],"backgroundTag":"template-render-failed","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}