{"record":{"id":"10bd5d1396395a6d","repo":"jax-ml/jax","slug":"api-version-r-is-not-available-available-versi","errorCode":null,"errorMessage":"{api_version=!r} is not available; available versions are: {[__array_api_version__]}","messagePattern":"(.+?) is not available; available versions are: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/array_api_metadata.py","lineNumber":40,"sourceCode":"from types import ModuleType\n\nfrom jax._src import config\nfrom jax._src import dtypes as _dtypes\nfrom jax._src import xla_bridge as xb\nfrom jax._src.lib import xla_client as xc\nfrom jax._src.sharding import Sharding\n\n\n__array_api_version__ = '2025.12'\n\n\ndef __array_namespace__(self, *, api_version: None | str = None) -> ModuleType:\n  \"\"\"Return the `Python array API`_ namespace for JAX.\n\n  .. _Python array API: https://data-apis.org/array-api/\n  \"\"\"\n  if api_version is not None and api_version != __array_api_version__:\n    raise ValueError(f\"{api_version=!r} is not available; \"\n                     f\"available versions are: {[__array_api_version__]}\")\n  import jax.numpy  # pyrefly: ignore[missing-import]\n  return jax.numpy\n\n\ndef __array_namespace_info__() -> ArrayNamespaceInfo:\n  return ArrayNamespaceInfo()\n\n\nclass ArrayNamespaceInfo:\n  \"\"\"Metadata for the `Python array API`_\n\n  .. _Python array API: https://data-apis.org/array-api/\n  \"\"\"\n  _capabilities = {\n    \"boolean indexing\": False,  # within transformations\n    \"data-dependent shapes\": False,  # within transformations\n    \"max dimensions\": 64,  # XLA limitation","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/array_api_metadata.py#L22-L58","documentation":"The array API __array_namespace__ protocol in JAX only supports the exact array API standard version JAX was built against (__array_api_version__). Requesting any other version string raises ValueError because JAX does not implement multiple versions of the standard.","triggerScenarios":"Calling arr.__array_namespace__(api_version='2023.12') (or similar) on a jax.Array when the requested version differs from jax.numpy's __array_api_version__ constant.","commonSituations":"Using array-API-compliant libraries that negotiate a specific standard version, or upgrading a dependency that pins an older/newer array API version than the installed JAX supports.","solutions":["Check jax.numpy.__array_api_version__ and pass exactly that version","Omit api_version to get the default namespace","Upgrade/downgrade JAX to the version whose array API support matches what the consuming library requests"],"exampleFix":"// before\nns = arr.__array_namespace__(api_version='2023.12')\n// after\nimport jax.numpy as jnp\nns = arr.__array_namespace__(api_version=jnp.__array_api_version__)","handlingStrategy":"validation","validationCode":"import jax.numpy as jnp\napi_version = jnp.__array_api_version__  # pass only this value or None","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Never hardcode array API version strings","Pin jax version alongside array-API-consuming libraries"],"tags":["jax","array-api","version-mismatch"],"backgroundTag":"api-version-unsupported","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}