{"record":{"id":"cfb4d04d79acdcc8","repo":"keras-team/keras","slug":"num-bins-must-be-greater-than-or-equal-to-0-rec","errorCode":null,"errorMessage":"`num_bins` must be greater than or equal to 0. Received: `num_bins={num_bins}`","messagePattern":"`num_bins` must be greater than or equal to 0\\. Received: `num_bins=(.+?)`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/preprocessing/discretization.py","lineNumber":126,"sourceCode":"                \"`'one_hot'`, `'multi_hot'`, or `'count'`. \"\n                f\"Received: sparse={sparse} and \"\n                f\"output_mode={output_mode}\"\n            )\n\n        argument_validation.validate_string_arg(\n            output_mode,\n            allowable_strings=(\n                \"int\",\n                \"one_hot\",\n                \"multi_hot\",\n                \"count\",\n            ),\n            caller_name=self.__class__.__name__,\n            arg_name=\"output_mode\",\n        )\n\n        if num_bins is not None and num_bins < 0:\n            raise ValueError(\n                \"`num_bins` must be greater than or equal to 0. \"\n                f\"Received: `num_bins={num_bins}`\"\n            )\n        if num_bins is not None and bin_boundaries is not None:\n            raise ValueError(\n                \"Both `num_bins` and `bin_boundaries` should not be set. \"\n                f\"Received: `num_bins={num_bins}` and \"\n                f\"`bin_boundaries={bin_boundaries}`\"\n            )\n        if num_bins is None and bin_boundaries is None:\n            raise ValueError(\n                \"You need to set either `num_bins` or `bin_boundaries`.\"\n            )\n\n        self.bin_boundaries = bin_boundaries\n        self.num_bins = num_bins\n        self.epsilon = epsilon\n        self.output_mode = output_mode","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/preprocessing/discretization.py#L108-L144","documentation":"Error \"`num_bins` must be greater than or equal to 0. Received: `num_bins={num_bins}`\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/preprocessing/discretization.py:126 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"}