jax-ml/jax · error · TypeError
dynamic_slice: unrecognized index {pidx.index}
Error message
dynamic_slice: unrecognized index {pidx.index} What it means
Second catch-all TypeError in to_dynamic_slice, raised in the start-index-building loop when an index type passed validation categorization but has no dynamic-slice start contribution. Indicates an internally unrecognized IndexType.
Source
Thrown at jax/_src/numpy/indexing.py:562
axis, = pidx.consumed_axes
size = self.shape[axis]
start, stop, stride = pidx.index.indices(size)
assert stride in [-1, 1] # validated above
if stride < 0:
new_start = stop + 1 + abs(start - stop - 1) % abs(stride)
start_indices.append(new_start)
slice_sizes.append(max(0, start + 1 - new_start))
rev_axes.append(axis)
else:
start_indices.append(start)
slice_sizes.append(max(0, stop - start))
elif pidx.typ == IndexType.DYNAMIC_SLICE:
assert isinstance(pidx.index, indexing.Slice)
start_indices.append(pidx.index.start)
slice_sizes.append(pidx.index.size)
trivial_slicing = False
else:
raise TypeError(f"dynamic_slice: unrecognized index {pidx.index}")
if len(start_indices) > 1:
# We must be careful with dtypes because dynamic_slice requires all
# start indices to have matching types.
dt = lax_utils.int_dtype_for_shape(self.shape, signed=True)
start_indices = [lax.convert_element_type(i, dt) for i in start_indices]
return _DynamicSliceIndexer(
start_indices=start_indices,
slice_sizes=slice_sizes,
rev_axes=rev_axes,
squeeze_axes=squeeze_axes,
newaxis_dims=newaxis_dims,
normalize_indices=normalize_indices,
trivial_slicing=trivial_slicing,
)
def is_advanced_int_indexer(self):View on GitHub (pinned to 1e1c6a8fc0)
Solutions
- Use only standard index types (int, slice, None, ..., scalar tracers)
- Check for a JAX version mismatch between jax and jaxlib
- File an issue with a minimal reproducer if using supported constructs
Defensive patterns
Strategy: validation
Prevention
- Use only standard index types
- Keep jax/jaxlib versions in sync
When it happens
Trigger: An index type that is not INTEGER/ELLIPSIS/NONE/SLICE/DYNAMIC_SLICE/ARRAY/BOOLEAN reaches the second loop of to_dynamic_slice — essentially an internal inconsistency or new index kind without dynamic support.
Common situations: Extending JAX with custom index types; mismatched JAX internal versions; extremely rare for end users.
Related errors
- dynamic_slice: only unit steps supported in slice. Got {pidx
- dynamic_slice: only scalar indices allowed. Got index of typ
- dynamic_slice: indices must be scalars or slices. Got index
- dynamic_slice: unrecognized index {pidx.index} at position {
- Value of type {type(self)} is not convertible to integer ind
AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27).
Data as JSON: /api/errors/578efd6ca2c9f217.
Report an issue: GitHub.