{"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":"Guard in the weak-type resolution helper (_respect_weak_type): a dtype flagged as a weak Python type did not fall into any recognized category (bool, float, int, complex). This is a generic sentinel for an unrecognized dtype string reaching internal dtype standardization.","triggerScenarios":"Thrown at keras/src/backend/common/dtypes.py:199 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass one of the allowed dtype names ('float16'/'float32'/'float64', 'int8'...'int64', 'uint8'...'uint64', 'bool', 'complex64'/'complex128', 'bfloat16', or weak names 'float'/'int'/'complex').","Check for typos like 'fp32' or 'float32x' in dtype arguments."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}