{"record":{"id":"0788d3a9f7696579","repo":"tensorflow/models","slug":"the-encoderscaffold-s-does-not-have-a-reference-t","errorCode":null,"errorMessage":"The EncoderScaffold %s does not have a reference to the embedding data. This is required when you pass a custom embedding network to the scaffold. It is also possible that you are trying to get embedding data from an embedding scaffold with a custom embedding network where the scaffold has been serialized and deserialized. Unfortunately, accessing custom embedding references after serialization is not yet supported.","messagePattern":"The EncoderScaffold (.+?) does not have a reference to the embedding data\\. This is required when you pass a custom embedding network to the scaffold\\. It is also possible that you are trying to get embedding data from an embedding scaffold with a custom embedding network where the scaffold has been serialized and deserialized\\. Unfortunately, accessing custom embedding references after serialization is not yet supported\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/networks/encoder_scaffold.py","lineNumber":367,"sourceCode":"  @classmethod\n  def from_config(cls, config, custom_objects=None):\n    cls_names = ['hidden_cls', 'mask_cls']\n    for cls_name in cls_names:\n      cls_string = '{}_string'.format(cls_name)\n      if cls_string in config:\n        config[cls_name] = tf_keras.utils.get_registered_object(\n            config[cls_string], custom_objects=custom_objects)\n        del config[cls_string]\n    return cls(**config)\n\n  def get_embedding_table(self):\n    if self._embedding_network is None:\n      # In this case, we don't have a custom embedding network and can return\n      # the standard embedding data.\n      return self._embedding_layer.embeddings  # pyrefly: ignore[missing-attribute]\n\n    if self._embedding_data is None:\n      raise RuntimeError(('The EncoderScaffold %s does not have a reference '\n                          'to the embedding data. This is required when you '\n                          'pass a custom embedding network to the scaffold. '\n                          'It is also possible that you are trying to get '\n                          'embedding data from an embedding scaffold with a '\n                          'custom embedding network where the scaffold has '\n                          'been serialized and deserialized. Unfortunately, '\n                          'accessing custom embedding references after '\n                          'serialization is not yet supported.') % self.name)\n    else:\n      return self._embedding_data\n\n  @property\n  def embedding_network(self):\n    if self._embedding_network is None:\n      raise RuntimeError(\n          ('The EncoderScaffold %s does not have a reference '\n           'to the embedding network. This is required when you '\n           'pass a custom embedding network to the scaffold.') % self.name)","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/networks/encoder_scaffold.py#L349-L385","documentation":"Error \"The EncoderScaffold %s does not have a reference to the embedding data. This is required when you pass a custom embedding network to the scaffold. It is also possible that you are trying to get embedding data from an embedding scaffold with a custom embedding network where the scaffold has been serialized and deserialized. Unfortunately, accessing custom embedding references after serialization is not yet supported.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/networks/encoder_scaffold.py:367 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"}