{"record":{"id":"c8ee611f3d067156","repo":"jax-ml/jax","slug":"partitions-cannot-overlap-with-unreduced-axes-pass","errorCode":null,"errorMessage":"partitions cannot overlap with unreduced axes passed to PartitionSpec. Got partitions: {partitions} and unreduced axes: {unreduced}","messagePattern":"partitions cannot overlap with unreduced axes passed to PartitionSpec\\. Got partitions: (.+?) and unreduced axes: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/partition_spec.py","lineNumber":50,"sourceCode":"        \" to the mesh axes.\")\n  if unreduced & reduced:\n    raise ValueError(\n        \"`unreduced` and `reduced` argument to PartitionSpec cannot overlap. \"\n        f\"Got unreduced: {unreduced} and reduced: {reduced}\")\n  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","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/partition_spec.py#L32-L68","documentation":"In the new-style PartitionSpec, axes listed in the positional partitions (classic sharding mapping) cannot also appear in the unreduced set — an axis is either a partitioning axis or an unreduced axis, not both.","triggerScenarios":"PartitionSpec(('data',), unreduced=('data',)) — the same mesh axis used both as a partition spec entry and in unreduced.","commonSituations":"Reusing an axis name in a spec template; generated specs where partitions and unreduced are filled from the same axis pool.","solutions":["Remove the axis from partitions or from unreduced so each appears in only one","If the axis should stay un-reduced, leave it out of the positional partitions entirely"],"exampleFix":"# before\nPartitionSpec(('data', 'model'), unreduced=('data',))\n# after\nPartitionSpec((None, 'model'), unreduced=('data',))","handlingStrategy":"validation","validationCode":"flat = {p for part in partitions for p in (part if isinstance(part, tuple) else (part,))}\nassert flat.isdisjoint(unreduced)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Each mesh axis should appear in exactly one role in a spec"],"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"}