{"record":{"id":"2222e2018373f898","repo":"keras-team/keras","slug":"label-mode-must-be-one-of-fine-coarse","errorCode":null,"errorMessage":"`label_mode` must be one of `\"fine\"`, `\"coarse\"`. Received: label_mode={label_mode}.","messagePattern":"`label_mode` must be one of `\"fine\"`, `\"coarse\"`\\. Received: label_mode=(.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/datasets/cifar100.py","lineNumber":56,"sourceCode":"    **`x_test`**: `uint8` NumPy array of grayscale image data with shapes\n      `(10000, 32, 32, 3)`, containing the test data. Pixel values range\n      from 0 to 255.\n\n    **`y_test`**: `uint8` NumPy array of labels (integers in range 0-99)\n      with shape `(10000, 1)` for the test data.\n\n    Example:\n\n    ```python\n    (x_train, y_train), (x_test, y_test) = keras.datasets.cifar100.load_data()\n    assert x_train.shape == (50000, 32, 32, 3)\n    assert x_test.shape == (10000, 32, 32, 3)\n    assert y_train.shape == (50000, 1)\n    assert y_test.shape == (10000, 1)\n    ```\n    \"\"\"\n    if label_mode not in [\"fine\", \"coarse\"]:\n        raise ValueError(\n            '`label_mode` must be one of `\"fine\"`, `\"coarse\"`. '\n            f\"Received: label_mode={label_mode}.\"\n        )\n\n    dirname = \"cifar-100-python-target\"\n    origin = \"https://www.cs.toronto.edu/~kriz/cifar-100-python.tar.gz\"\n    path = get_file(\n        fname=dirname,\n        origin=origin,\n        extract=True,\n        file_hash=(  # noqa: E501\n            \"85cd44d02ba6437773c5bbd22e183051d648de2e7d6b014e1ef29b855ba677a7\"\n        ),\n    )\n\n    path = os.path.join(path, \"cifar-100-python\")\n    fpath = os.path.join(path, \"train\")\n    x_train, y_train = load_batch(fpath, label_key=f\"{label_mode}_labels\")","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/datasets/cifar100.py#L38-L74","documentation":"Error \"`label_mode` must be one of `\"fine\"`, `\"coarse\"`. Received: label_mode={label_mode}.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/datasets/cifar100.py:56 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"}