{"record":{"id":"336b35097225f18e","repo":"XX-net/XX-Net","slug":"detect-platform-fail-s","errorCode":null,"errorMessage":"detect platform fail:%s","messagePattern":"detect platform fail:(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/launcher/sys_platform.py","lineNumber":151,"sourceCode":"    platform_lib = \"\"\n\n    import time\n    import gc\n    gc.set_threshold(200, 12, 12)\n\n    def show_systray():\n        while global_var.running:\n            time.sleep(30)\n            count = gc.get_count()\n            c = gc.collect()\n            xlog.debug(\"GC: count: %d,%d,%d Collect:%d\", count[0], count[1], count[2], c)\n\n    def on_quit():\n        from non_tray import sys_tray\n        sys_tray.on_quit()\n\nelse:\n    xlog.warn((\"detect platform fail:%s\" % sys.platform))\n\n    platform = \"unknown\"\n    has_desktop = False\n    platform_lib = \"\"\n    from non_tray import sys_tray\n\n    def show_systray():\n        sys_tray.serve_forever()\n\n    def on_quit():\n        sys_tray.on_quit()\n","sourceCodeStart":133,"sourceCodeEnd":163,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/sys_platform.py#L133-L163","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running under Cygwin/WSL oddities, BSD, or a non-standard Python distribution; also possible with very old/new Python versions reporting unexpected platform strings.","solutions":["Check python3 -c 'import sys; print(sys.platform)' and compare with the branches in launcher/sys_platform.py","Run under a supported platform (Linux, macOS, Windows native python) for tray support","If you need the platform supported, add a branch for that sys.platform value mapping to an appropriate tray backend","On 'unknown' platforms, manage the launcher through its web interface since no tray icon will appear"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import sys\nsupported = {'darwin','win32','linux'}\nif sys.platform not in supported:\n    print('unsupported platform %s; tray disabled' % sys.platform)","typeGuard":"def is_supported_platform(p: str) -> bool:\n    return p in ('darwin','win32','linux')","tryCatchPattern":null,"preventionTips":["Run on a supported OS for full tray support","File an issue/patch adding your sys.platform to the detection chain","Use the web UI on unsupported platforms"],"tags":["platform-detection","portability","systray"],"backgroundTag":"unsupported-platform","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}