{"record":{"id":"d53ed33761205991","repo":"keras-team/keras","slug":"repeated-axis-in-axis-axis","errorCode":null,"errorMessage":"Repeated axis in `axis`: {axis}","messagePattern":"Repeated axis in `axis`: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/jax/sparse.py","lineNumber":34,"sourceCode":"        insert_dims: `False` turns dimensions in `axis` to 1s (use case:\n          reduction along `axis` with `keep_dims=True`). `True`, inserts 1s\n          according to `axis` (use case: `expand_dims`).\n    Returns:\n        A tuple of three lists\n        - The canonical value for `axis`: always a list, negative values have\n          been resolved and values are sorted in ascending order.\n        - The output shape: `input_shape` with 1s at the indices in `axis`, for\n          use as the `shape` argument of `broadcast_in_dim`.\n        - The broadcast dimensions: list of dimensions not in `axis`, for use as\n          the `broadcast_dimensions` argument of `broadcast_in_dim`.\n    \"\"\"\n    if axis is None:\n        raise ValueError(\"Received `None` value for `axis`\")\n    if isinstance(axis, int):\n        axis = (axis,)\n    # Check uniqueness.\n    if len(set(axis)) != len(axis):\n        raise ValueError(f\"Repeated axis in `axis`: {axis}\")\n    result_dims = len(input_shape)\n    if insert_dims:\n        result_dims += len(axis)\n\n    # Resolve negative values.\n    canonical_axis = []\n    for a in axis:\n        if not -result_dims <= a < result_dims:\n            raise ValueError(\n                f\"In `axis`, axis {a} is out of bounds for array \"\n                f\"of dimension {result_dims}\"\n            )\n        if a < 0:\n            a = a + result_dims\n        canonical_axis.append(a)\n\n    # Check uniqueness again after resolving negative values.\n    if len(set(canonical_axis)) != len(canonical_axis):","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/jax/sparse.py#L16-L52","documentation":"Error \"Repeated axis in `axis`: {axis}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/jax/sparse.py:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}