{"record":{"id":"6111e206c7456583","repo":"keras-team/keras","slug":"sparse-true-can-only-be-used-with-the-tensorflow-6111e2","errorCode":null,"errorMessage":"`sparse=True` can only be used with the TensorFlow backend.","messagePattern":"`sparse=True` can only be used with the TensorFlow backend\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/preprocessing/text_vectorization.py","lineNumber":235,"sourceCode":"        ngrams=None,\n        output_mode=\"int\",\n        output_sequence_length=None,\n        pad_to_max_tokens=False,\n        vocabulary=None,\n        idf_weights=None,\n        sparse=False,\n        ragged=False,\n        encoding=\"utf-8\",\n        name=None,\n        **kwargs,\n    ):\n        if not tf.available:\n            raise ImportError(\n                \"Layer TextVectorization requires TensorFlow. \"\n                \"Install it via `pip install tensorflow`.\"\n            )\n        if sparse and backend.backend() != \"tensorflow\":\n            raise ValueError(\n                \"`sparse=True` can only be used with the TensorFlow backend.\"\n            )\n        if ragged and backend.backend() != \"tensorflow\":\n            raise ValueError(\n                \"`ragged=True` can only be used with the TensorFlow backend.\"\n            )\n\n        # 'standardize' must be one of\n        # (None, \"lower_and_strip_punctuation\", \"lower\", \"strip_punctuation\",\n        # callable)\n        argument_validation.validate_string_arg(\n            standardize,\n            allowable_strings=(\n                \"lower_and_strip_punctuation\",\n                \"lower\",\n                \"strip_punctuation\",\n            ),\n            caller_name=self.__class__.__name__,","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/preprocessing/text_vectorization.py#L217-L253","documentation":"Error \"`sparse=True` can only be used with the TensorFlow backend.\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/preprocessing/text_vectorization.py:235 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"}