{"record":{"id":"2b07eac08411cb64","repo":"keras-team/keras","slug":"invalid-coordinates-rank-expected-at-least-rank-2-2b07ea","errorCode":null,"errorMessage":"Invalid coordinates rank: expected at least rank 2. Received input with shape: {coordinates.shape}","messagePattern":"Invalid coordinates rank: expected at least rank 2\\. Received input with shape: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/numpy/image.py","lineNumber":930,"sourceCode":"    homography_matrix = np.linalg.solve(coefficient_matrix, target_vector)\n    homography_matrix = np.reshape(homography_matrix, [-1, 8])\n    return homography_matrix.astype(compute_dtype)\n\n\ndef map_coordinates(\n    inputs, coordinates, order, fill_mode=\"constant\", fill_value=0.0\n):\n    inputs = convert_to_tensor(inputs)\n    coordinates = convert_to_tensor(coordinates)\n    if coordinates.shape[0] != len(inputs.shape):\n        raise ValueError(\n            \"First dim of `coordinates` must be the same as the rank of \"\n            \"`inputs`. \"\n            f\"Received inputs with shape: {inputs.shape} and coordinate \"\n            f\"leading dim of {coordinates.shape[0]}\"\n        )\n    if len(coordinates.shape) < 2:\n        raise ValueError(\n            \"Invalid coordinates rank: expected at least rank 2.\"\n            f\" Received input with shape: {coordinates.shape}\"\n        )\n    if fill_mode not in MAP_COORDINATES_FILL_MODES:\n        raise ValueError(\n            \"Invalid value for argument `fill_mode`. Expected one of \"\n            f\"{set(MAP_COORDINATES_FILL_MODES.keys())}. Received: \"\n            f\"fill_mode={fill_mode}\"\n        )\n    if order not in range(2):\n        raise ValueError(\n            \"Invalid value for argument `order`. Expected one of \"\n            f\"{[0, 1]}. Received: order={order}\"\n        )\n    # SciPy's implementation of map_coordinates handles boundaries incorrectly,\n    # unless mode='reflect'. For order=1, this only affects interpolation\n    # outside the bounds of the original array.\n    # https://github.com/scipy/scipy/issues/2640","sourceCodeStart":912,"sourceCodeEnd":948,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/numpy/image.py#L912-L948","documentation":"Error \"Invalid coordinates rank: expected at least rank 2. Received input with shape: {coordinates.shape}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/numpy/image.py:930 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"}