jax-ml/jax · error · ValueError

{api_version=!r} is not available; available versions are: {

Error message

{api_version=!r} is not available; available versions are: {[__array_api_version__]}

What it means

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.

Source

Thrown at jax/_src/numpy/array_api_metadata.py:40

from types import ModuleType

from jax._src import config
from jax._src import dtypes as _dtypes
from jax._src import xla_bridge as xb
from jax._src.lib import xla_client as xc
from jax._src.sharding import Sharding


__array_api_version__ = '2025.12'


def __array_namespace__(self, *, api_version: None | str = None) -> ModuleType:
  """Return the `Python array API`_ namespace for JAX.

  .. _Python array API: https://data-apis.org/array-api/
  """
  if api_version is not None and api_version != __array_api_version__:
    raise ValueError(f"{api_version=!r} is not available; "
                     f"available versions are: {[__array_api_version__]}")
  import jax.numpy  # pyrefly: ignore[missing-import]
  return jax.numpy


def __array_namespace_info__() -> ArrayNamespaceInfo:
  return ArrayNamespaceInfo()


class ArrayNamespaceInfo:
  """Metadata for the `Python array API`_

  .. _Python array API: https://data-apis.org/array-api/
  """
  _capabilities = {
    "boolean indexing": False,  # within transformations
    "data-dependent shapes": False,  # within transformations
    "max dimensions": 64,  # XLA limitation

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Check jax.numpy.__array_api_version__ and pass exactly that version
  2. Omit api_version to get the default namespace
  3. Upgrade/downgrade JAX to the version whose array API support matches what the consuming library requests

Example fix

// before
ns = arr.__array_namespace__(api_version='2023.12')
// after
import jax.numpy as jnp
ns = arr.__array_namespace__(api_version=jnp.__array_api_version__)
Defensive patterns

Strategy: validation

Validate before calling

import jax.numpy as jnp
api_version = jnp.__array_api_version__  # pass only this value or None

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27). Data as JSON: /api/errors/10bd5d1396395a6d. Report an issue: GitHub.