XX-net/XX-Net · warning

detect platform fail:%s

Error message

detect platform fail:%s

What it means

The platform detection if/elif chain in sys_platform found no match for sys.platform, so the launcher marks the platform as 'unknown', disables desktop support (has_desktop=False) and uses the non_tray backend. The warning names the unrecognized platform string.

Source

Thrown at code/default/launcher/sys_platform.py:151

    platform_lib = ""

    import time
    import gc
    gc.set_threshold(200, 12, 12)

    def show_systray():
        while global_var.running:
            time.sleep(30)
            count = gc.get_count()
            c = gc.collect()
            xlog.debug("GC: count: %d,%d,%d Collect:%d", count[0], count[1], count[2], c)

    def on_quit():
        from non_tray import sys_tray
        sys_tray.on_quit()

else:
    xlog.warn(("detect platform fail:%s" % sys.platform))

    platform = "unknown"
    has_desktop = False
    platform_lib = ""
    from non_tray import sys_tray

    def show_systray():
        sys_tray.serve_forever()

    def on_quit():
        sys_tray.on_quit()

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Check python3 -c 'import sys; print(sys.platform)' and compare with the branches in launcher/sys_platform.py
  2. Run under a supported platform (Linux, macOS, Windows native python) for tray support
  3. If you need the platform supported, add a branch for that sys.platform value mapping to an appropriate tray backend
  4. On 'unknown' platforms, manage the launcher through its web interface since no tray icon will appear
Defensive patterns

Strategy: fallback

Validate before calling

import sys
supported = {'darwin','win32','linux'}
if sys.platform not in supported:
    print('unsupported platform %s; tray disabled' % sys.platform)

Type guard

def is_supported_platform(p: str) -> bool:
    return p in ('darwin','win32','linux')

Prevention

When it happens

Trigger: Running on an OS whose sys.platform is not one of the handled values (darwin/win32/linux and friends), e.g. cygwin, freebsd, or an exotic Python build.

Common situations: Running under Cygwin/WSL oddities, BSD, or a non-standard Python distribution; also possible with very old/new Python versions reporting unexpected platform strings.

Related errors


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