{"record":{"id":"f4d21da9106df134","repo":"jax-ml/jax","slug":"vector-clock-size-must-be-at-least-1-but-got-sel","errorCode":null,"errorMessage":"Vector clock size must be at least 1, but got {self.vector_clock_size}.","messagePattern":"Vector clock size must be at least 1, but got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/_src/pallas/mosaic/interpret/params.py","lineNumber":100,"sourceCode":"  \"\"\"\n\n  detect_races: bool = False\n  out_of_bounds_reads: Literal[\"raise\", \"uninitialized\"] = \"raise\"\n  skip_floating_point_ops: bool = False\n  uninitialized_memory: Literal[\"nan\", \"zero\"] = \"nan\"\n  num_cores_or_threads: int = 1\n  vector_clock_size: int | None = None\n  logging_mode: LoggingMode | None = None\n\n  def __post_init__(self):\n    if self.num_cores_or_threads < 1:\n      raise ValueError(\n          \"Number of cores or threads must be at least 1, but got\"\n          f\" {self.num_cores_or_threads}.\"\n      )\n    if self.vector_clock_size is not None and self.vector_clock_size < 1:\n      # Further validation is done in `get_vector_clock_size` below.\n      raise ValueError(\n          \"Vector clock size must be at least 1, but got\"\n          f\" {self.vector_clock_size}.\"\n      )\n\n  def get_vector_clock_size(self, num_devices) -> int:\n    \"\"\"Returns the number of vector clocks to use for TPU interpret mode.`\"\"\"\n    num_cores_or_threads = num_devices * self.num_cores_or_threads\n    if self.vector_clock_size is not None:\n      if num_cores_or_threads >= self.vector_clock_size:\n        raise ValueError(\n            f\"Vector clock size ({self.vector_clock_size}) must be greater than\"\n            f\" the total number of cores/threads ({num_cores_or_threads}).\"\n        )\n      return self.vector_clock_size\n    else:\n      # Default to twice the total number of cores/threads.\n      return 2 * num_cores_or_threads\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/pallas/mosaic/interpret/params.py#L82-L118","documentation":"The interpret-mode params dataclass validates vector_clock_size (used for race detection across simulated cores) must be at least 1 when provided; passing 0 or negative raises this ValueError in __post_init__.","triggerScenarios":"Constructing interpret params with vector_clock_size=0 or negative — commonly from a computed value (e.g., number of clocks derived from device count or grid size) that evaluates to 0.","commonSituations":"Enabling race detection with a clock size derived from an empty device list or zero-sized grid; config plumbing where None vs 0 is confused; automated tuning scripts producing 0.","solutions":["Pass a positive integer or leave vector_clock_size=None to use the default from get_vector_clock_size","Clamp computed values: max(1, computed_clocks)","Validate config before constructing the params object"],"exampleFix":"# before\nparams = interpret_params(vector_clock_size=num_devices - 1)  # 0 with 1 device\n# after\nparams = interpret_params(vector_clock_size=max(1, num_devices - 1))  # or omit","handlingStrategy":"validation","validationCode":"assert vector_clock_size is None or (isinstance(vector_clock_size, int) and vector_clock_size >= 1)","typeGuard":"def is_valid_clock_size(n) -> bool:\n    return n is None or (isinstance(n, int) and not isinstance(n, bool) and n >= 1)","tryCatchPattern":"try:\n    params = InterpretParams(vector_clock_size=n)\nexcept ValueError as e:\n    if 'Vector clock size' in str(e):\n        params = InterpretParams()  # use default via get_vector_clock_size","preventionTips":["Omit vector_clock_size unless race detection needs a specific size","Clamp computed values with max(1, x)","Treat 0 from computed expressions as None/default"],"tags":["jax","pallas","tpu","config-validation","race-detection"],"backgroundTag":"invalid-configuration","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}