{"record":{"id":"d31ce7ab1fd7a9c6","repo":"jax-ml/jax","slug":"static-slice-unrecognized-index-pidx-index-at-p","errorCode":null,"errorMessage":"static_slice: unrecognized index {pidx.index} at position {position}.","messagePattern":"static_slice: unrecognized index (.+?) at position (.+?)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/indexing.py","lineNumber":406,"sourceCode":"    # Validation of the unmodified user indices.\n    if parsed_mode == slicing.GatherScatterMode.PROMISE_IN_BOUNDS:\n      self.validate_static_indices(normalize_indices=normalize_indices)\n    self.validate_slices()\n\n    # For sharded inputs, indexing (like x[0]) and partial slices (like x[:2] as\n    # opposed to x[:]) lead to incorrect sharding semantics when computed via slice.\n    # TODO(yashkatariya): fix slice with sharding\n    if arr_is_sharded and self.has_partial_slices():\n      raise ValueError(\"static_slice with partial slices does not support nontrivial array sharding.\")\n\n    for position, pidx in enumerate(self.indices):\n      if pidx.typ in [IndexType.INTEGER, IndexType.ELLIPSIS, IndexType.SLICE, IndexType.NONE]:\n        pass\n      elif pidx.typ in [IndexType.ARRAY, IndexType.BOOLEAN, IndexType.DYNAMIC_SLICE]:\n        raise TypeError(\"static_slice: indices must be static scalars or slices.\"\n                        f\" Got index of type {type(pidx.index)} at position {position}\")\n      else:\n        raise TypeError(f\"static_slice: unrecognized index {pidx.index} at position {position}.\")\n\n    # Now re-iterate to generate static slices.\n    start_indices: list[int] = []\n    limit_indices: list[int] = []\n    strides: list[int] = []\n    rev_axes: list[int] = []\n    squeeze_axes: list[int] = []\n    newaxis_dims: list[int] = []\n\n    expanded = self.expand_ellipses()\n    for pidx in expanded.indices:\n      if pidx.typ in [IndexType.ARRAY, IndexType.BOOLEAN, IndexType.ELLIPSIS]:\n        raise RuntimeError(f\"Internal: unexpected index encountered: {pidx}\")\n      elif pidx.typ == IndexType.NONE:\n        # Expanded axes indices are based on the rank of the array after slicing\n        # (tracked by start_indices) and squeezing (tracked by squeeze_axes), and\n        # expand_dims inserts dimensions in order, so we must also account for\n        # previous expanded dimensions.","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/indexing.py#L388-L424","documentation":"Defensive fallback in to_static_slice's index-type dispatch: a ParsedIndex whose IndexType is not one of the recognized kinds triggers TypeError. Should be unreachable via public APIs because from_index only produces known types; like error 1425 it signals an internal/version inconsistency.","triggerScenarios":"Manually constructed NDIndexer/ParsedIndex with an exotic typ, or a JAX internal version mismatch between modules.","commonSituations":"Monkey-patching, vendored/partial JAX installs, or mixed jax/jaxlib versions.","solutions":["Reinstall/align jax and jaxlib to one version","Avoid constructing ParsedIndex manually; use public indexing","Report upstream with a repro if triggered by plain indexing"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin matching jax/jaxlib versions","Avoid manual ParsedIndex construction"],"tags":["jax","internal","invariant"],"backgroundTag":"library-internal-invariant-violation","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}