{"record":{"id":"e6e2332730ef6922","repo":"jax-ml/jax","slug":"the-addressable-data-method-was-called-on-self","errorCode":null,"errorMessage":"The addressable_data() method was called on {self._error_repr()}.{self._origin_msg()}","messagePattern":"The addressable_data\\(\\) method was called on (.+?)\\.(.+?)","errorType":"exception","errorClass":"ConcretizationTypeError","httpStatus":null,"severity":"error","filePath":"jax/_src/core.py","lineNumber":1234,"sourceCode":"          for name, pp_payload in contents])\n      ])))\n    return base\n\n  def __repr__(self):\n    return self._pretty_print(verbose=False).format()\n\n  def _contents(self):\n    try:\n      return [(name, getattr(self, name)) for name in self.__slots__]\n    except AttributeError:\n      return ()\n\n  def _origin_msg(self) -> str:\n    return \"\"\n\n  # Methods that are only valid for materialized arrays\n  def addressable_data(self, index):\n    raise ConcretizationTypeError(self,\n      f\"The addressable_data() method was called on {self._error_repr()}.\"\n      f\"{self._origin_msg()}\")\n\n  def delete(self):\n    raise ConcretizationTypeError(self,\n      f\"The delete() method was called on {self._error_repr()}.\"\n      f\"{self._origin_msg()}\")\n\n  def devices(self):\n    raise ConcretizationTypeError(self,\n      f\"The devices() method was called on {self._error_repr()}.\"\n      f\"{self._origin_msg()}\")\n\n  @property\n  def global_shards(self):\n    raise ConcretizationTypeError(self,\n      f\"The global_shards property was called on {self._error_repr()}.\"\n      f\"{self._origin_msg()}\")","sourceCodeStart":1216,"sourceCodeEnd":1252,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/core.py#L1216-L1252","documentation":"ConcretizationTypeError raised when Tracer.addressable_data(index) is called. addressable_data is only implemented for materialized arrays (it returns the per-process shard of a sharded jax.Array); tracers carry no buffers, so during tracing (jit/grad/vmap/etc.) the base-class stub raises.","triggerScenarios":"Calling `x.addressable_data(i)` on a value that is a JAX Tracer, i.e. inside jax.jit, jax.grad, vmap, pmap, lax.scan, remat, or custom derivative rules.","commonSituations":"Code written against sharded pjit/SPMD arrays is reused inside a jitted function; inspection/debug helper that dumps shards is accidentally called under a transform; sharded checkpoint restore code path runs under vmap.","solutions":["Move the addressable_data() call outside the traced function: compute shard layout before entering jit and pass results as static/closed-over constants.","If you need per-shard data under SPMD, restructure to use sharding-aware ops (e.g. pjit with in_shardings, jax.lax ops, or addressable data computed after the jit call returns).","Guard with isinstance(x, jax.Array) before calling, and take a tracing-time fallback path.","If you intended a concrete value but got a tracer, check for an accidentally nested jit/grad wrapping (e.g. grad-of-jit where the inner call is traced)."],"exampleFix":"// before\n@jax.jit\ndef f(x):\n    local = x.addressable_data(0)  # ConcretizationTypeError\n    return local.sum()\n\n// after\n@jax.jit\ndef f(x):\n    return x.sum()\n# inspect shards outside tracing:\n# y.addressable_data(0)","handlingStrategy":"type-guard","validationCode":"import jax\n\ndef call_addressable_data(x, index):\n    if isinstance(x, jax.core.Tracer):\n        raise ValueError('x is traced; inspect shards outside jit/grad/vmap')\n    return x.addressable_data(index)","typeGuard":"from jax.core import Tracer\nimport jax\n\ndef is_materialized_array(x) -> bool:\n    return isinstance(x, jax.Array) and not isinstance(x, Tracer)","tryCatchPattern":"from jax.errors import ConcretizationTypeError\ntry:\n    shard = x.addressable_data(0)\nexcept ConcretizationTypeError:\n    shard = None  # traced value; handle shard logic on the host instead","preventionTips":["Design shard-inspection as a host-side step around the traced kernel.","Static-typing hints (jax.Array) plus review of jit bodies for array-only methods.","Keep a checklist of array-only APIs (addressable_data, devices, global_shards...) banned inside traces."],"tags":["jax","concretization","tracer","sharding","addressable-data"],"backgroundTag":"jax-tracer-concretization-error","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}