XX-net/XX-Net · error

render %s except:%r

Error message

render %s except:%r

What it means

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.

Source

Thrown at code/default/launcher/web_control.py:366

            #     target_module = 'smart_router'
            #     target_menu = 'config'
            elif config.enable_gae_proxy:
                target_module = 'gae_proxy'
                target_menu = 'status'
            else:
                target_module = 'launcher'
                target_menu = 'about'

        if len(module_menus) == 0:
            self.load_module_menus()

        # i18n code lines (Both the locale dir & the template dir are module-dependent)
        locale_dir = os.path.abspath(os.path.join(current_path, 'lang'))
        fn = os.path.join(current_path, "web_ui", "index.html")
        try:
            index_content = i18n_translator.render(locale_dir, fn)
        except Exception as e:
            xlog.warn("render %s except:%r", fn, e)
            return self.send_not_found()

        menu_content = b''
        for module, v in module_menus:
            # xlog.debug("m:%s id:%d", module, v['menu_sort_id'])
            title = v["module_title"]
            menu_content += b'<li class="nav-header">%s</li>\n' % utils.to_bytes(title)
            for sub_id in v['sub_menus']:
                list_meta = b''
                web_id = v['sub_menus'][sub_id].get("id")
                if web_id:
                    list_meta += b' id="%s"' % sub_id

                sub_title = v['sub_menus'][sub_id]['title']
                if "url" in v['sub_menus'][sub_id]:
                    sub_url = v['sub_menus'][sub_id]['url']
                    if target_module == module and target_menu == sub_url:
                        list_meta += b'class="active"'

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Confirm code/default/launcher/web_ui/index.html exists and is readable.
  2. Restore lang/ and templates from a fresh download of the same version.
  3. Check the log's %r exception for the precise template/i18n cause.
  4. Reinstall/repair the installation if files are corrupt.
Defensive patterns

Strategy: try-catch

Validate before calling

import os
fn = os.path.join(current_path,'web_ui','index.html')
if not os.path.isfile(fn) or not os.access(fn, os.R_OK):
    return send_not_found()

Try / catch

try:
    content = i18n_translator.render(locale_dir, fn)
except Exception:
    log.exception('render failed for %s', fn)
    return send_not_found()

Prevention

When it happens

Trigger: Missing/corrupt web_ui/index.html, unreadable lang/ directory, bad template syntax, or an i18n/encoding error in the translator.

Common situations: Incomplete install or failed update leaving index.html absent; permission issues in the launcher dir; locale files with invalid escape sequences after manual editing.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/54d48c4306bd5dd3. Report an issue: GitHub.