{"record":{"id":"dd4dfcd778abdbba","repo":"keras-team/keras","slug":"invalid-value-for-argument-dtype-expected-one-o","errorCode":null,"errorMessage":"Invalid value for argument `dtype`. Expected one of {ALLOWED_DTYPES}. Received: dtype={dtype}","messagePattern":"Invalid value for argument `dtype`\\. Expected one of (.+?)\\. Received: dtype=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/common/dtypes.py","lineNumber":199,"sourceCode":"        # e.g, tf.float32 == float is True\n        is_weak_type = True\n    return standardize_dtype(value), is_weak_type\n\n\n@functools.lru_cache(maxsize=None)\ndef _respect_weak_type(dtype, weak_type):\n    \"\"\"Return the weak dtype of `dtype` if `weak_type==True`.\"\"\"\n    if weak_type:\n        if dtype == \"bool\":\n            return dtype\n        elif \"float\" in dtype:\n            return \"float\"\n        elif \"int\" in dtype:\n            return \"int\"\n        elif \"complex\" in dtype:\n            return \"complex\"\n        else:\n            raise ValueError(\n                \"Invalid value for argument `dtype`. Expected one of \"\n                f\"{ALLOWED_DTYPES}. Received: dtype={dtype}\"\n            )\n    return dtype\n\n\n@functools.lru_cache(maxsize=None)\ndef _resolve_weak_type(dtype, precision=\"32\"):\n    \"\"\"Resolve weak type by the precision of `backend.floatx()`.\"\"\"\n    extended_allowed_dtypes = set(ALLOWED_DTYPES).union(WEAK_TYPES)\n    if dtype not in extended_allowed_dtypes:\n        raise ValueError(\n            \"Invalid value for argument `dtype`. Expected one of \"\n            f\"{extended_allowed_dtypes}. Received: dtype={dtype}\"\n        )\n    if precision not in [\"16\", \"32\", \"64\"]:\n        raise ValueError(\n            f\"Invalid value for argument `precision`. Expected one of \"","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/common/dtypes.py#L181-L217","documentation":"Error \"Invalid value for argument `dtype`. Expected one of {ALLOWED_DTYPES}. Received: dtype={dtype}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/common/dtypes.py:199 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"}