{"record":{"id":"c0eba575e3fb62b1","repo":"keras-team/keras","slug":"received-an-invalid-value-for-units-expected-a-c0eba5","errorCode":null,"errorMessage":"Received an invalid value for `units`, expected a positive integer. Received: units={units}","messagePattern":"Received an invalid value for `units`, expected a positive integer\\. Received: units=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/core/ternary_dense.py","lineNumber":125,"sourceCode":"    \"\"\"\n\n    def __init__(\n        self,\n        units,\n        threshold=None,\n        activation=None,\n        use_bias=True,\n        kernel_initializer=\"glorot_uniform\",\n        bias_initializer=\"zeros\",\n        kernel_regularizer=None,\n        bias_regularizer=None,\n        activity_regularizer=None,\n        kernel_constraint=None,\n        bias_constraint=None,\n        **kwargs,\n    ):\n        if not isinstance(units, int) or units <= 0:\n            raise ValueError(\n                \"Received an invalid value for `units`, expected a positive \"\n                f\"integer. Received: units={units}\"\n            )\n        if threshold is not None and not isinstance(threshold, (int, float)):\n            raise ValueError(\n                \"Received an invalid value for `threshold`, expected a float \"\n                f\"or None. Received: threshold={threshold}\"\n            )\n        if threshold is not None and threshold < 0:\n            raise ValueError(\n                \"Received an invalid value for `threshold`, expected a \"\n                \"non-negative float or None. \"\n                f\"Received: threshold={threshold}\"\n            )\n\n        super().__init__(activity_regularizer=activity_regularizer, **kwargs)\n        self.units = units\n        self.threshold = threshold","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/core/ternary_dense.py#L107-L143","documentation":"Error \"Received an invalid value for `units`, expected a positive integer. Received: units={units}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/layers/core/ternary_dense.py:125 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"}