{"record":{"id":"689e6fd08af2ff28","repo":"jax-ml/jax","slug":"make-gloo-tcp-collectives-only-implemented-for-lin","errorCode":null,"errorMessage":"make_gloo_tcp_collectives only implemented for linux and macos","messagePattern":"make_gloo_tcp_collectives only implemented for linux and macos","errorType":"exception","errorClass":"xla::XlaRuntimeError","httpStatus":null,"severity":"error","filePath":"jaxlib/jax.cc","lineNumber":427,"sourceCode":"        std::shared_ptr<xla::KeyValueStoreInterface> kv_store = nullptr;\n        if (distributed_client != nullptr) {\n          kv_store = GetDistributedKeyValueStore(distributed_client,\n                                                 /*key_prefix=*/\"cpu:\");\n        }\n        auto gloo_kv_store =\n            std::make_unique<xla::cpu::GlooKeyValueStore>(kv_store);\n        auto uv_attrs = gloo::transport::uv::attr();\n        if (hostname) {\n          uv_attrs.hostname = *hostname;\n        }\n        if (interface) {\n          uv_attrs.iface = *interface;\n        }\n        auto uv_device = gloo::transport::uv::CreateDevice(uv_attrs);\n        return std::make_shared<xla::cpu::GlooCollectives>(\n            std::move(gloo_kv_store), std::move(uv_device));\n#else   // defined(__linux__)\n        throw xla::XlaRuntimeError(\n            \"make_gloo_tcp_collectives only implemented for linux and macos\");\n#endif  // defined(__linux__)\n      },\n      nb::arg(\"distributed_client\"), nb::arg(\"hostname\").none() = std::nullopt,\n      nb::arg(\"interface\").none() = std::nullopt);\n\n#if !defined(_WIN32) && !defined(PLATFORM_GOOGLE)\n  nb::class_<xla::cpu::MpiCollectives> mpi_collectives(m, \"MpiCollectives\",\n                                                       cpu_collectives);\n  mpi_collectives.def(\"Init\", &xla::cpu::MpiCollectives::Init);\n  mpi_collectives.def(\"Finalize\", &xla::cpu::MpiCollectives::Finalize);\n  m.def(\"make_mpi_collectives\",\n        []() -> std::shared_ptr<xla::cpu::MpiCollectives> {\n          return std::make_shared<xla::cpu::MpiCollectives>();\n        });\n#else   // !_WIN32 && !PLATFORM_GOOGLE\n  m.def(\"make_mpi_collectives\",\n        []() -> std::shared_ptr<xla::cpu::CpuCollectives> {","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jaxlib/jax.cc#L409-L445","documentation":"make_gloo_tcp_collectives compiles the gloo TCP transport only on Linux (and macOS); on the #else branch (e.g. Windows) the binding exists but throws at call time.","triggerScenarios":"Calling jaxlib.make_gloo_tcp_collectives(...) on Windows (or any platform where the gloo uv transport is not compiled in).","commonSituations":"Running jax multi-host CPU collectives on Windows, where gloo's transport layer is not built.","solutions":["Run under WSL2 or a Linux container","Use a different collective backend available on your platform (e.g. MPI build of jaxlib)","Check platform before calling and skip distributed CPU collectives on Windows"],"exampleFix":"# before\nimport jaxlib\nkv = jaxlib.make_gloo_tcp_collectives(client, hostname)\n# after\nimport sys, jaxlib\nkv = jaxlib.make_gloo_tcp_collectives(client, hostname) if sys.platform == 'linux' else None","handlingStrategy":"type-guard","validationCode":"import sys\nassert sys.platform in ('linux', 'darwin'), 'gloo TCP collectives unsupported here'","typeGuard":"def gloo_supported() -> bool:\n    import sys; return sys.platform.startswith('linux')","tryCatchPattern":"try:\n    coll = jaxlib.make_gloo_tcp_collectives(...)\nexcept Exception:\n    coll = None  # degrade to single-process","preventionTips":["Gate distributed CPU code on platform checks","Run distributed jobs on Linux/WSL2"],"tags":["jax","gloo","collectives","platform-support"],"backgroundTag":"platform-not-supported","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}