{"record":{"id":"a64decc66f6c4093","repo":"tensorflow/models","slug":"inside-a-program-we-should-not-bind-the-config-wi","errorCode":null,"errorMessage":"Inside a program, we should not bind the config with a class twice.","messagePattern":"Inside a program, we should not bind the config with a class twice\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/modeling/hyperparams/base_config.py","lineNumber":43,"sourceCode":"from 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\n\n  return decorator\n\n\ndef _is_optional(field):","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/modeling/hyperparams/base_config.py#L25-L61","documentation":"Error \"Inside a program, we should not bind the config with a class twice.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/modeling/hyperparams/base_config.py:43 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"}