{"record":{"id":"7561ee2535bc78ab","repo":"jax-ml/jax","slug":"partitions-cannot-overlap-with-reduced-axes-passed","errorCode":null,"errorMessage":"partitions cannot overlap with reduced axes passed to PartitionSpec. Got partitions: {partitions} and reduced axes: {reduced}","messagePattern":"partitions cannot overlap with reduced axes passed to PartitionSpec\\. Got partitions: (.+?) and reduced axes: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/partition_spec.py","lineNumber":55,"sourceCode":"  if unreduced_kind is not None and not isinstance(unreduced_kind, UnreducedKind):\n      raise TypeError(\n          \"Expected unreduced_kind to be of type `jax.sharding.UnreducedKind`\"\n          f\" but got {type(unreduced_kind)}\")\n  if not unreduced and unreduced_kind is not None:\n    raise ValueError(\n        \"`unreduced_kind` should be `None` when `unreduced` is an empty set.\"\n        f\" Got {unreduced_kind=} and {unreduced=}\")\n\n  for partition in partitions:\n    partition = partition if isinstance(partition, tuple) else (partition,)\n    for p in partition:\n      if p in unreduced:\n        raise ValueError(\n            \"partitions cannot overlap with unreduced axes passed to\"\n            f\" PartitionSpec. Got partitions: {partitions} and unreduced axes:\"\n            f\" {unreduced}\")\n      if p in reduced:\n        raise ValueError(\n            \"partitions cannot overlap with reduced axes passed to\"\n            f\" PartitionSpec. Got partitions: {partitions} and reduced axes:\"\n            f\" {reduced}\")\n\ndef _get_ur_str(unreduced, reduced):\n  if unreduced and reduced:\n    return f\"unreduced={set(unreduced)!r}, reduced={set(reduced)!r}\"\n  elif unreduced and not reduced:\n    return f\"unreduced={set(unreduced)!r}\"\n  elif not unreduced and reduced:\n    return f\"reduced={set(reduced)!r}\"\n  assert False  # unreachable\n\n_canonicalize_partition = _jax.canonicalize_partition  # type: ignore\n_canonicalize_partitions = _jax.canonicalize_partitions  # type: ignore\n\ndef _get_default_unconstrained(): return _UNCONSTRAINED_PARTITION\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/partition_spec.py#L37-L73","documentation":"Axes in the positional partitions of a PartitionSpec cannot also appear in the reduced set; a reduced axis is fully summed and cannot simultaneously define how a dimension is sharded.","triggerScenarios":"PartitionSpec(('data',), reduced=('data', 'model')) — 'data' is both a partitioning axis and a reduction axis.","commonSituations":"Spec generation that marks every mesh axis as reduced while also using them in partitions; migration from older sharding APIs.","solutions":["Remove the axis from the partitions entry (use None in that position) or drop it from reduced","Validate spec construction: assert set(flat_partitions).isdisjoint(reduced)"],"exampleFix":"# before\nPartitionSpec(('data', 'model'), reduced=('data',))\n# after\nPartitionSpec((None, 'model'), reduced=('data',))","handlingStrategy":"validation","validationCode":"flat = {p for part in partitions for p in (part if isinstance(part, tuple) else (part,))}\nassert flat.isdisjoint(reduced)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use None in partition positions for axes that are reduced"],"tags":["jax","sharding","partition-spec","mesh"],"backgroundTag":"conflicting-configuration","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}