jax-ml/jax · error · AttributeError

has no `manual_axis_type`.

Error message

{self!r} has no `manual_axis_type`.

What it means

AttributeError raised by the manual-aval wrapper's manual_axis_type property when the inner aval does not carry a manual axis type (i.e. is not inside a manual-axis scope). Fires on `.manual_axis_type` access on such wrapped state.

Solutions

  1. Guard with getattr(ref, 'manual_axis_type', None)
  2. Check the aval type supports manual axes before access
  3. Provide a default axis type in calling code
Defensive patterns

Strategy: type-guard

Type guard

def ref_has_manual_axes(ref):
    return hasattr(getattr(ref, "inner_aval", None), "manual_axis_type")

Prevention

When it happens

Trigger: Accessing .manual_axis_type or .mat on a ref whose inner aval doesn't support manual axes (non-array or plain ShapedArray without manual axis info).

Common situations: Code written against avals with manual axis types being reused with ordinary avals.

Related errors


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

Appendix: source

Thrown at jax/_src/state/types.py:557

      raise AttributeError(
          f"{self!r} has no `dtype`."
      ) from None

  @property
  def sharding(self):
    try:
      return self.inner_aval.sharding  # pyrefly: ignore[missing-attribute]
    except AttributeError:
      raise AttributeError(
          f"{self!r} has no `sharding`."
      ) from None

  @property
  def manual_axis_type(self):
    try:
      return self.inner_aval.manual_axis_type  # pyrefly: ignore[missing-attribute]
    except AttributeError:
      raise AttributeError(
          f"{self!r} has no `manual_axis_type`."
      ) from None

  @property
  def mat(self):
    return self.manual_axis_type

  @core.aval_property
  def at(self):
    return RefIndexer(self)

  @core.aval_method
  def bitcast(self, dtype):
    return TransformedRef(self, ()).bitcast(dtype)

  @core.aval_method
  def reshape(self, *shape):
    return TransformedRef(self, ()).reshape(*shape)

View on GitHub (pinned to 1e1c6a8fc0)