{"record":{"id":"c9d37e0acbff1dd4","repo":"tensorflow/models","slug":"exactly-one-of-bert-config-file-and-encoder-con","errorCode":null,"errorMessage":"Exactly one of `bert_config_file` and `encoder_config_file` can be specified, but got %s and %s.","messagePattern":"Exactly one of `bert_config_file` and `encoder_config_file` can be specified, but got (.+?) and (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/tools/export_tfhub.py","lineNumber":179,"sourceCode":"    \"Assert ops in tf.functions used in Dataset.map() on a TPU worker, \"\n    \"and omitting the Assert ops lets SavedModels avoid the issue.\")\n\n\ndef main(argv):\n  if len(argv) > 1:\n    raise app.UsageError(\"Too many command-line arguments.\")\n  gin.parse_config_files_and_bindings(FLAGS.gin_file, FLAGS.gin_params)\n\n  if bool(FLAGS.vocab_file) == bool(FLAGS.sp_model_file):\n    raise ValueError(\"Exactly one of `vocab_file` and `sp_model_file` \"\n                     \"can be specified, but got %s and %s.\" %\n                     (FLAGS.vocab_file, FLAGS.sp_model_file))\n  do_lower_case = export_tfhub_lib.get_do_lower_case(\n      FLAGS.do_lower_case, FLAGS.vocab_file, FLAGS.sp_model_file)\n\n  if FLAGS.export_type in (\"model\", \"model_with_mlm\"):\n    if bool(FLAGS.bert_config_file) == bool(FLAGS.encoder_config_file):\n      raise ValueError(\"Exactly one of `bert_config_file` and \"\n                       \"`encoder_config_file` can be specified, but got \"\n                       \"%s and %s.\" %\n                       (FLAGS.bert_config_file, FLAGS.encoder_config_file))\n    if FLAGS.bert_config_file:\n      bert_config = configs.BertConfig.from_json_file(FLAGS.bert_config_file)\n      encoder_config = None\n    else:\n      bert_config = None\n      encoder_config = encoders.EncoderConfig()\n      encoder_config = hyperparams.override_params_dict(\n          encoder_config, FLAGS.encoder_config_file, is_strict=True)\n    export_tfhub_lib.export_model(\n        FLAGS.export_path,\n        bert_config=bert_config,\n        encoder_config=encoder_config,\n        model_checkpoint_path=FLAGS.model_checkpoint_path,\n        vocab_file=FLAGS.vocab_file,\n        sp_model_file=FLAGS.sp_model_file,","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/tools/export_tfhub.py#L161-L197","documentation":"Error \"Exactly one of `bert_config_file` and `encoder_config_file` can be specified, but got %s and %s.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/tools/export_tfhub.py:179 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"}