{"record":{"id":"8ebaaac017d13740","repo":"jax-ml/jax","slug":"collective-id-has-to-be-specified-when-using-a-cus","errorCode":null,"errorMessage":"collective_id has to be specified when using a custom barrier (cannot auto-allocate without lowering context)","messagePattern":"collective_id has to be specified when using a custom barrier \\(cannot auto-allocate without lowering context\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/tpu_custom_call.py","lineNumber":790,"sourceCode":"        # and the auto-assigned collective ids so far.\n        if (collective_id\n            in ctx.module_context.pallas_collective_id_mapping.auto.values()):\n          raise ValueError(\n              f\"The manually assigned {collective_id=} in {kernel_name=}\"\n              \" conflicts with an existing auto-assigned collective id.\"\n              \" Auto-assignment uses a base collective id of\"\n              f\" {_AUTO_COLLECTIVE_BASE_ID}. Please use values away from this\"\n              \" offset.\"\n          )\n        ctx.module_context.pallas_collective_id_mapping.manual[key] = (\n            collective_id\n        )\n        ctx.module_context.pallas_collective_id_mapping.all_ids.add(\n            collective_id\n        )\n\n    if collective_id is None:\n      raise ValueError(\n          \"collective_id has to be specified when using a custom barrier \"\n          \"(cannot auto-allocate without lowering context)\"\n      )\n  elif collective_id is not None and not allow_collective_id_without_custom_barrier:\n    raise ValueError(\n        \"collective_id has to be unspecified or None when not using a custom\"\n        \" barrier\"\n    )\n  if vmem_limit_bytes is not None and not isinstance(vmem_limit_bytes, int):\n    raise ValueError(\n        \"vmem_limit_bytes must be an int: provided with a\"\n        f\" {type(vmem_limit_bytes)}.\"\n    )\n  if tiling is not None and  device_type != \"sparsecore\":\n    raise ValueError(\n        \"explicit tiling is only supported for SparseCore kernels.\"\n    )\n  if opt_level is not None and device_type != \"sparsecore\":","sourceCodeStart":772,"sourceCodeEnd":808,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/tpu_custom_call.py#L772-L808","documentation":"A custom barrier is requested but no collective_id is given and there is no lowering context to auto-allocate one.","triggerScenarios":"Calling the lowering path with use_semaphore or custom barrier params but collective_id=None outside a proper lowering context.","commonSituations":"Using custom barriers in ahead-of-time or manually driven lowering without providing ids.","solutions":["Explicitly pass an integer collective_id when using a custom barrier","Drop the custom barrier if not needed"],"exampleFix":"// before\nlower(..., custom_barrier=True)\n// after\nlower(..., custom_barrier=True, collective_id=100000)","handlingStrategy":"validation","validationCode":"if custom_barrier and collective_id is None:\n    raise ValueError('provide collective_id')  # fail fast with your own message","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair custom barriers with an explicit integer collective_id"],"tags":["tpu","pallas","collective-id","barrier","missing-argument"],"backgroundTag":"missing-required-parameter","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}