jax-ml/jax · error · ValueError

Expected {len(update_block_spec.block_shape)} start indices,

Error message

Expected {len(update_block_spec.block_shape)} start indices, got {len(clamped_starts)}

What it means

Error "Expected {len(update_block_spec.block_shape)} start indices, got {len(clamped_starts)}" thrown in jax-ml/jax.

Source

Thrown at jax/_src/pallas/fuser/block_spec.py:3361

    )
  if operand_block_spec is not pallas_core.no_block_spec:
    if update_block_spec is not pallas_core.no_block_spec:
      raise ValueError(
          'Cannot push block spec from both operand and update simultaneously.'
      )
    return operand_block_spec
  if update_block_spec is pallas_core.no_block_spec:
    return pallas_core.no_block_spec

  operand_shape = ctx.avals_in[0].shape
  update_shape = ctx.avals_in[1].shape

  def new_index_map(*args):
    clamped_starts = _get_clamped_slice_starts(
        ctx, operand_shape, update_shape, start_idx_offset=2
    )
    if len(clamped_starts) != len(update_block_spec.block_shape):
      raise ValueError(
          f'Expected {len(update_block_spec.block_shape)} start indices, got'
          f' {len(clamped_starts)}'
      )
    idx = update_block_spec.index_map(*args)
    assert len(idx) == len(update_block_spec.block_shape)
    out_idx = list(idx)
    bs = update_block_spec.block_shape
    for i in range(len(out_idx)):
      out_idx[i] = _offset_indexer(
          bs[i], out_idx[i], clamped_starts[i], update_shape[i]
      )
    return tuple(out_idx)

  return update_block_spec.replace(index_map=new_index_map)


@register_push_block_spec_rule(lax.stack_p)
def _stack_push_rule(

View on GitHub (pinned to 1e1c6a8fc0)

When it happens

Trigger: Thrown at jax/_src/pallas/fuser/block_spec.py:3361 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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