{"record":{"id":"b974f920de93677e","repo":"jax-ml/jax","slug":"unrecognized-index-type-typ","errorCode":null,"errorMessage":"Unrecognized index type: {typ}","messagePattern":"Unrecognized index type: (.+?)","errorType":"validation","errorClass":"IndexError","httpStatus":null,"severity":"error","filePath":"jax/_src/numpy/indexing.py","lineNumber":157,"sourceCode":"  ellipses_indices: list[int] = []\n  index_types: list[IndexType] = []\n  for i, idx in enumerate(indices):\n    typ = IndexType.from_index(idx)\n    index_types.append(typ)\n\n    if typ == IndexType.NONE:\n      dimensions_consumed.append(0)\n    elif typ == IndexType.ELLIPSIS:\n      # We don't yet know how many dimensions are consumed, so set to zero\n      # for now and update later.\n      dimensions_consumed.append(0)\n      ellipses_indices.append(i)\n    elif typ == IndexType.BOOLEAN:\n      dimensions_consumed.append(np.ndim(idx))  # pyrefly: ignore[bad-argument-type]\n    elif typ in [IndexType.INTEGER, IndexType.ARRAY, IndexType.SLICE, IndexType.DYNAMIC_SLICE]:\n      dimensions_consumed.append(1)\n    else:\n      raise IndexError(f\"Unrecognized index type: {typ}\")\n\n  # 2. Validate the consumed dimensions and ellipses.\n  if len(ellipses_indices) > 1:\n    raise IndexError(\"an index can only have a single ellipsis ('...')\")\n  total_consumed = sum(dimensions_consumed)\n  if total_consumed > len(shape):\n    raise IndexError(f\"Too many indices: array is {len(shape)}-dimensional,\"\n                     f\" but {total_consumed} were indexed\")\n  if ellipses_indices:\n    dimensions_consumed[ellipses_indices[0]] = len(shape) - total_consumed\n\n  # 3. Generate the final sequence of parsed indices.\n  result: list[ParsedIndex] = []\n  current_dim = 0\n  for index, typ, n_consumed in safe_zip(indices, index_types, dimensions_consumed):\n    consumed_axes = tuple(range(current_dim, current_dim + n_consumed))\n    current_dim += len(consumed_axes)\n    result.append(ParsedIndex(index=index, typ=typ, consumed_axes=consumed_axes))","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/numpy/indexing.py#L139-L175","documentation":"_parse_indices hit an IndexType enum value it does not know when computing how many dimensions each index consumes. In practice this is an internal invariant violation, not something user input should produce — the from_index classifier only emits the known types.","triggerScenarios":"Calling NDIndexer.from_raw_indices / internal parsing with a manually constructed index list containing an out-of-enum IndexType, or a mismatched JAX version where new enum members aren't handled.","commonSituations":"Mixing JAX versions in one environment, monkey-patching internals, or constructing IndexType/ParsedIndex objects directly in downstream libraries.","solutions":["Ensure a single consistent jax version is installed (pip install -U jax)","Don't construct ParsedIndex/IndexType by hand; go through public x[...] API or from_raw_indices with raw indices","If it appears with normal indexing, report a JAX bug with a minimal repro"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import jax; assert jax.__version__ == jax.lib.version  # version consistency check","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin jax/jaxlib versions together","Avoid constructing internal ParsedIndex/IndexType objects"],"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"}