jax-ml/jax · error · ConcretizationTypeError

The global_shards property was called on {self._error_repr()

Error message

The global_shards property was called on {self._error_repr()}.{self._origin_msg()}

What it means

ConcretizationTypeError raised when the Tracer.global_shards property is accessed. global_shards exposes per-shard metadata (Array committed buffers) only for materialized jax.Arrays; a tracer has no shard layout data attached, so the property stub raises during tracing.

Source

Thrown at jax/_src/core.py:1250

  # Methods that are only valid for materialized arrays
  def addressable_data(self, index):
    raise ConcretizationTypeError(self,
      f"The addressable_data() method was called on {self._error_repr()}."
      f"{self._origin_msg()}")

  def delete(self):
    raise ConcretizationTypeError(self,
      f"The delete() method was called on {self._error_repr()}."
      f"{self._origin_msg()}")

  def devices(self):
    raise ConcretizationTypeError(self,
      f"The devices() method was called on {self._error_repr()}."
      f"{self._origin_msg()}")

  @property
  def global_shards(self):
    raise ConcretizationTypeError(self,
      f"The global_shards property was called on {self._error_repr()}."
      f"{self._origin_msg()}")

  def is_deleted(self):
    raise ConcretizationTypeError(self,
      f"The is_deleted() method was called on {self._error_repr()}."
      f"{self._origin_msg()}")

  @property
  def is_fully_addressable(self):
    raise ConcretizationTypeError(self,
      f"The is_fully_addressable property was called on {self._error_repr()}."
      f"{self._origin_msg()}")

  @property
  def is_fully_replicated(self):
    raise ConcretizationTypeError(self,
      f"The is_fully_replicated property was called on {self._error_repr()}."

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Access global_shards outside the traced region, on the concrete arrays returned/accepted by jit.
  2. Use jax.typeof(x) / x.sharding via aval information for sharding inspection under tracing (per the guidance in the adjacent code).
  3. If shard info drives control flow, hoist it out: compute sharding before jit and pass it as a static parameter.
  4. Strip debug prints of shard state from traced functions before production.

Example fix

// before
@jax.jit
def f(x):
    print(x.global_shards)  # ConcretizationTypeError
    return x * 2

// after
@jax.jit
def f(x):
    return x * 2
# outside: y = f(x); print(y.global_shards)
Defensive patterns

Strategy: type-guard

Validate before calling

import jax

def get_global_shards(x):
    if isinstance(x, jax.core.Tracer):
        raise ValueError('inspect global_shards on concrete arrays, outside transforms')
    return x.global_shards

Type guard

import jax
from jax.core import Tracer

def shard_info_available(x) -> bool:
    return isinstance(x, jax.Array) and not isinstance(x, Tracer)

Try / catch

from jax.errors import ConcretizationTypeError
try:
    shards = x.global_shards
except ConcretizationTypeError:
    shards = ()  # traced; inspect after the transform returns

Prevention

When it happens

Trigger: Reading `x.global_shards` on a traced value inside jit/pjit/grad/vmap/scan/remat or a custom rule; also via logging/printing that touches the property.

Common situations: Debugging SPMD/pjit sharding by printing global_shards, then leaving the print inside a traced function; monitoring sharding state inside a training loop that is jitted; refactoring sharding-inspection helpers into code paths later wrapped by vmap.

Related errors


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