{"record":{"id":"a1898e7ac233925b","repo":"tensorflow/models","slug":"the-bind-decorator-is-supposed-to-apply-on-the-cla","errorCode":null,"errorMessage":"The bind decorator is supposed to apply on the class attribute. Received {config_cls}, not a class.","messagePattern":"The bind decorator is supposed to apply on the class attribute\\. Received (.+?), not a class\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/modeling/hyperparams/base_config.py","lineNumber":38,"sourceCode":"import inspect\nimport types\nimport typing\nfrom typing import Any, List, Mapping, Optional, Type, Union\n\nfrom absl import logging\nimport tensorflow as tf, tf_keras\nimport yaml\n\nfrom official.modeling.hyperparams import params_dict\n\n\n_BOUND = set()\n\n\ndef bind(config_cls):\n  \"\"\"Bind a class to config cls.\"\"\"\n  if not inspect.isclass(config_cls):\n    raise ValueError('The bind decorator is supposed to apply on the class '\n                     f'attribute. Received {config_cls}, not a class.')\n\n  def decorator(builder):\n    if config_cls in _BOUND:\n      raise ValueError('Inside a program, we should not bind the config with a'\n                       ' class twice.')\n    if inspect.isclass(builder):\n      config_cls._BUILDER = builder  # pylint: disable=protected-access\n    elif inspect.isfunction(builder):\n\n      def _wrapper(self, *args, **kwargs):  # pylint: disable=unused-argument\n        return builder(*args, **kwargs)\n\n      config_cls._BUILDER = _wrapper  # pylint: disable=protected-access\n    else:\n      raise ValueError(f'The `BUILDER` type is not supported: {builder}')\n    _BOUND.add(config_cls)\n    return builder","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/modeling/hyperparams/base_config.py#L20-L56","documentation":"Error \"The bind decorator is supposed to apply on the class attribute. Received {config_cls}, not a class.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/modeling/hyperparams/base_config.py:38 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":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}