{"record":{"id":"ac811879231ae8ab","repo":"xai-org/x-algorithm","slug":"the-compiled-async-emb-extension-at-async-emb-api","errorCode":null,"errorMessage":"the compiled async_emb extension at {async_emb_api.__file__} does not match these bindings (stale build?): {e}","messagePattern":"the compiled async_emb extension at (.+?) does not match these bindings \\(stale build\\?\\): (.+?)","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"critical","filePath":"phoenix/xrex/cuda/async_emb/async_emb.py","lineNumber":59,"sourceCode":"            \"execute\": async_emb_api.rowwise_adagrad_update_start(),\n        },\n        platform=\"CUDA\",\n    )\n    jax.ffi.register_ffi_target(\n        \"xrex_async_emb_rowwise_adagrad_lazy_update_start\",\n        fn={\n            \"initialize\": async_emb_api.rowwise_adagrad_lazy_update_start_init(),\n            \"execute\": async_emb_api.rowwise_adagrad_lazy_update_start(),\n        },\n        platform=\"CUDA\",\n    )\n    jax.ffi.register_ffi_target(\n        \"xrex_async_emb_rowwise_adagrad_update_done\",\n        fn=async_emb_api.rowwise_adagrad_update_done(),\n        platform=\"CUDA\",\n    )\nexcept AttributeError as e:\n    raise ImportError(\n        f\"the compiled async_emb extension at {async_emb_api.__file__} does not \"\n        f\"match these bindings (stale build?): {e}\"\n    ) from e\n\n\nclass AsyncEmbContextHandle(NamedTuple):\n    context_id: int\n    group_size: int\n    flatten_replicas: tuple[int, ...]\n    tokens_per_rank: int\n    shard_width: int\n    emb_width: int\n    num_unique: int\n    num_devices_per_node: int\n    mesh: jax.sharding.Mesh\n    table_axis: tuple[str, ...]\n    data_axis: tuple[str, ...]\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/xrex/cuda/async_emb/async_emb.py#L41-L77","documentation":"The bindings register FFI targets against the compiled async_emb_api extension by calling attribute accessors like rowwise_adagrad_update_done(); an AttributeError means the installed .so at async_emb_api.__file__ was built from an older/newer source than these Python bindings expect. It is a stale or version-mismatched build of the extension relative to the bindings module.","triggerScenarios":"Compiling the async_emb src/ from one repo checkout (or an older commit) and then running Python bindings from another; pulling new code that registers new FFI symbols while the previously built .so lacks them; partial rebuild that copied an old artifact.","commonSituations":"git pull / branch switch after the kernels gained new entry points; a wheel-installed extension alongside a source checkout; Docker layer caching that reuses an old build; mixing pip install -e with a manually built .so.","solutions":["Rebuild the async_emb extension from the current checkout (see build notes in xrex/cuda/__init__.py), making sure the freshly built module is the one being imported.","Print async_emb_api.__file__ (e.g. python -c \"import xrex.cuda.async_emb.src.async_emb_api as m; print(m.__file__)\") to find the stale .so and delete/replace it.","Uninstall any wheel version of the extension that shadows your source build, then rebuild.","Verify the required symbols exist: dir(async_emb_api) should include rowwise_adagrad_update_done and the other registered entry points."],"exampleFix":"# before: stale .so missing new symbols\npython -c \"from xrex.cuda.async_emb.src import async_emb_api; print(async_emb_api.__file__)\"\n# -> /site-packages/async_emb_api.cpython-310.so   (old wheel)\n\n# after: remove stale artifact and rebuild from current source\npip uninstall async_emb  # if a wheel shadows the build\ncd phoenix/xrex/cuda/async_emb/src && python setup.py build_ext --inplace\npython -c \"from xrex.cuda.async_emb.src import async_emb_api; print(async_emb_api.__file__)\"\n# -> .../phoenix/xrex/cuda/async_emb/src/async_emb_api...so","handlingStrategy":"validation","validationCode":"from xrex.cuda.async_emb.src import async_emb_api\nREQUIRED = (\"rowwise_adagrad_update_done\",)  # extend with the other FFI entry points\nmissing = [s for s in REQUIRED if not hasattr(async_emb_api, s)]\nif missing:\n    raise RuntimeError(\n        f\"stale async_emb build at {async_emb_api.__file__}; rebuild src/. missing: {missing}\"\n    )","typeGuard":null,"tryCatchPattern":"try:\n    from xrex.cuda.async_emb.async_emb import AsyncEmbContextHandle\nexcept ImportError as e:\n    if \"stale build\" in str(e):\n        raise RuntimeError(\"rebuild xrex/cuda/async_emb/src after pulling new code\") from e\n    raise","preventionTips":["Rebuild the extension as part of your pull/CI script (make cuda or equivalent), not manually.","Check async_emb_api.__file__ points into your checkout, not an old wheel."],"tags":["cuda","ffi","stale-build","abi-mismatch","native-extension"],"backgroundTag":"native-extension-abi-mismatch","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}