{"record":{"id":"da4d35c2f4b060cd","repo":"tensorflow/models","slug":"exactly-one-of-vocab-file-and-sp-model-file-ca","errorCode":null,"errorMessage":"Exactly one of `vocab_file` and `sp_model_file` can be specified, but got %s and %s.","messagePattern":"Exactly one of `vocab_file` and `sp_model_file` can be specified, but got (.+?) and (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/tools/export_tfhub.py","lineNumber":171,"sourceCode":"    help=\"List of paths to the config files.\")\nflags.DEFINE_multi_string(\n    \"gin_params\", default=None,\n    help=\"List of Gin bindings.\")\nflags.DEFINE_bool(  # TODO(b/175369555): Remove this flag and its use.\n    \"experimental_disable_assert_in_preprocessing\", False,\n    \"Export a preprocessing model without tf.Assert ops. \"\n    \"Usually, that would be a bad idea, except TF2.4 has an issue with \"\n    \"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(","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/tools/export_tfhub.py#L153-L189","documentation":"Error \"Exactly one of `vocab_file` and `sp_model_file` can be specified, but got %s and %s.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/tools/export_tfhub.py:171 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"}