{"record":{"id":"b064a311a473df63","repo":"tensorflow/models","slug":"flag-s-must-be-provided-in-mode-s","errorCode":null,"errorMessage":"Flag `%s` must be provided in mode %s.","messagePattern":"Flag `(.+?)` must be provided in mode (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/finetuning/glue/flags.py","lineNumber":113,"sourceCode":"\n\ndef validate_flags(flags_obj: flags.FlagValues,\n                   file_exists_fn: Callable[[str], bool]):\n  \"\"\"Raises ValueError if any flags are misconfigured.\n\n  Args:\n    flags_obj: A `flags.FlagValues` object, usually from `flags.FLAG`.\n    file_exists_fn: A callable to decide if a file path exists or not.\n  \"\"\"\n\n  def _check_path_exists(flag_path, flag_name):\n    if not file_exists_fn(flag_path):\n      raise ValueError('Flag `%s` at %s does not exist.' %\n                       (flag_name, flag_path))\n\n  def _validate_path(flag_path, flag_name):\n    if not flag_path:\n      raise ValueError('Flag `%s` must be provided in mode %s.' %\n                       (flag_name, flags_obj.mode))\n    _check_path_exists(flag_path, flag_name)\n\n  if 'train' in flags_obj.mode:\n    _validate_path(flags_obj.train_input_path, 'train_input_path')\n    _validate_path(flags_obj.input_meta_data_path, 'input_meta_data_path')\n\n    if flags_obj.gin_file:\n      for gin_file in flags_obj.gin_file:\n        _check_path_exists(gin_file, 'gin_file')\n    if flags_obj.config_file:\n      for config_file in flags_obj.config_file:\n        _check_path_exists(config_file, 'config_file')\n\n  if 'eval' in flags_obj.mode:\n    _validate_path(flags_obj.validation_input_path, 'validation_input_path')\n\n  if flags_obj.mode == 'predict':","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/finetuning/glue/flags.py#L95-L131","documentation":"Error \"Flag `%s` must be provided in mode %s.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/finetuning/glue/flags.py:113 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"}