{"record":{"id":"f57c9d636b48b935","repo":"jax-ml/jax","slug":"self-r-has-no-sharding-f57c9d","errorCode":null,"errorMessage":"{self!r} has no `sharding`.","messagePattern":"(.+?) has no `sharding`\\.","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"jax/_src/state/types.py","lineNumber":548,"sourceCode":"      raise AttributeError(\n          f\"{self!r} has no `shape`.\"\n      ) from None\n\n  @property\n  def dtype(self):\n    try:\n      return self.inner_aval.dtype  # pyrefly: ignore[missing-attribute]\n    except AttributeError:\n      raise AttributeError(\n          f\"{self!r} has no `dtype`.\"\n      ) from None\n\n  @property\n  def sharding(self):\n    try:\n      return self.inner_aval.sharding  # pyrefly: ignore[missing-attribute]\n    except AttributeError:\n      raise AttributeError(\n          f\"{self!r} has no `sharding`.\"\n      ) from None\n\n  @property\n  def manual_axis_type(self):\n    try:\n      return self.inner_aval.manual_axis_type  # pyrefly: ignore[missing-attribute]\n    except AttributeError:\n      raise AttributeError(\n          f\"{self!r} has no `manual_axis_type`.\"\n      ) from None\n\n  @property\n  def mat(self):\n    return self.manual_axis_type\n\n  @core.aval_property\n  def at(self):","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/state/types.py#L530-L566","documentation":"RefRValue.sharding raises AttributeError when the inner aval carries no sharding information (e.g. an unsharded or non-array aval).","triggerScenarios":"Reading .sharding on a ref whose inner_aval doesn't expose a sharding property.","commonSituations":"Inspecting sharding in generic code across mixed ref types; refs created outside sharded contexts.","solutions":["Use getattr(ref, 'sharding', None)","Check inner_aval type first","Only inspect sharding on refs known to be sharded"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def ref_has_sharding(ref):\n    return hasattr(getattr(ref, \"inner_aval\", None), \"sharding\")","tryCatchPattern":null,"preventionTips":["Use getattr(ref, 'sharding', None)","Only inspect sharding on sharded refs"],"tags":["jax","sharding","attribute-error"],"backgroundTag":"missing-attribute-access","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}