{"record":{"id":"9d4d697d6ff45a1c","repo":"jax-ml/jax","slug":"the-process-id-of-the-current-process-must-be-defi","errorCode":null,"errorMessage":"The process id of the current process must be defined.","messagePattern":"The process id of the current process must be defined\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/distributed.py","lineNumber":141,"sourceCode":"    if (cluster_detection_method != 'deactivate' and\n        None in (coordinator_address, num_processes, process_id, local_device_ids)):\n      (coordinator_address, num_processes, process_id, local_device_ids) = (\n          clusters.ClusterEnv.auto_detect_unset_distributed_params(\n              coordinator_address,\n              num_processes,\n              process_id,\n              local_device_ids,\n              cluster_detection_method,\n              initialization_timeout,\n          )\n      )\n\n    if coordinator_address is None:\n      raise ValueError('coordinator_address should be defined.')\n    if num_processes is None:\n      raise ValueError('Number of processes must be defined.')\n    if process_id is None:\n      raise ValueError('The process id of the current process must be defined.')\n    if not isinstance(process_id, int):\n      raise TypeError(\"process_id must be a nonnegative int. \"\n                      f\"Got process_id={process_id} of type {type(process_id)}.\")\n    if not isinstance(num_processes, int):\n      raise TypeError(\"num_processes must be a positive int. \"\n                      f\"Got num_processes={num_processes} of type {type(num_processes)}.\")\n    if not (0 <= process_id < num_processes):\n      raise ValueError(\"process_id and num_processes must be nonnegative, with process_id < num_processes. \"\n                       f\"Got process_id={process_id}, num_processes={num_processes}.\")\n\n    self.coordinator_address = coordinator_address\n\n    # The default value of [::]:port tells the coordinator to bind to all\n    # available addresses on the same port as coordinator_address.\n    default_coordinator_bind_address = '[::]:' + coordinator_address.rsplit(':', 1)[1]\n    coordinator_bind_address = (coordinator_bind_address or\n                                os.environ.get('JAX_COORDINATOR_BIND_ADDRESS',\n                                               default_coordinator_bind_address))","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/distributed.py#L123-L159","documentation":"jax.distributed.initialize requires process_id (this process's rank) to be set explicitly; there is no default. None raises this ValueError during argument validation.","triggerScenarios":"Calling initialize without process_id, or with process_id=None, even when coordinator_address and num_processes are provided.","commonSituations":"Rank plumbing from torchrun/mpirun/slurm forgotten; assuming rank 0 implicitly; env var name mismatch (RANK vs LOCAL_RANK).","solutions":["Pass process_id from the launcher: int(os.environ['RANK']) (torchrun) or the SLURM procid","Use cluster_detection_method to infer rank automatically","Verify process_id is the global rank, not the local node rank (LOCAL_RANK)"],"exampleFix":"# before\njax.distributed.initialize(coordinator_address=addr, num_processes=8)\n# after\njax.distributed.initialize(coordinator_address=addr, num_processes=8,\n    process_id=int(os.environ['RANK']))","handlingStrategy":"validation","validationCode":"import os\nrank = os.environ.get('RANK') or os.environ.get('SLURM_PROCID')\nassert rank is not None, 'process_id unresolved'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use global RANK, not LOCAL_RANK","Populate rank via launcher env in every container/process"],"tags":["jax","distributed","rank","config"],"backgroundTag":"missing-required-config","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}