jax-ml/jax · error · ValueError

position {position} is out of range for clock {self.clock}

Error message

position {position} is out of range for clock {self.clock}

What it means

VectorClock.inc was called with a position index >= the clock's length. Each clock slot corresponds to one simulated thread/core; incrementing a slot beyond the clock means more threads are active than the clock was sized for.

Source

Thrown at jax/_src/pallas/mosaic/interpret/vector_clock.py:56

    self.clock = np.zeros(vector_clock_size, dtype=np.int32)

  def copy(self) -> Self:
    new = self.__new__(self.__class__)
    new.clock = self.clock.copy()
    return new

  def update(self, other: Self) -> None:
    self.clock[:] = np.maximum(self.clock[:], other.clock[:])

  def lt(self, other: Self) -> bool:
    return bool((self.clock <= other.clock).all() & (self.clock < other.clock).any())

  def ordered(self, other: Self) -> bool:
    return self.lt(other) or other.lt(self)

  def inc(self, position: int) -> None:
    if position >= len(self.clock):
      raise ValueError(f'position {position} is out of range for clock {self.clock}')
    assert position < len(self.clock)
    self.clock[position] += 1

View on GitHub (pinned to 1e1c6a8fc0)

Solutions

  1. Set vector_clock_size to None to use the automatic default (2x total cores/threads)
  2. Set vector_clock_size > total number of simulated threads
  3. Verify num_cores_or_threads matches the actual thread count used in the simulation
Defensive patterns

Strategy: validation

Validate before calling

n_threads = num_devices * params.num_cores_or_threads
size = params.vector_clock_size if params.vector_clock_size is not None else 2 * n_threads
assert position < size, 'clock position out of range; under-sized vector clock'

Prevention

When it happens

Trigger: Race detection incrementing a clock for thread index >= vector_clock_size; typically when vector_clock_size was manually set too small relative to concurrently running simulated threads.

Common situations: Setting InterpretParams.vector_clock_size manually and under-sizing it; changing num_cores_or_threads without adjusting the clock; version changes in race-detection plumbing.

Related errors


AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27). Data as JSON: /api/errors/2e46e8e37b3ad1f8. Report an issue: GitHub.