{"record":{"id":"a8d2e4f7cc83c701","repo":"tensorflow/models","slug":"for-training-each-question-should-have-exactly-1","errorCode":null,"errorMessage":"For training, each question should have exactly 1 answer.","messagePattern":"For training, each question should have exactly 1 answer\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/xlnet/squad_utils.py","lineNumber":454,"sourceCode":"  with tf.io.gfile.GFile(input_file, \"r\") as reader:\n    input_data = json.load(reader)[\"data\"]\n\n  examples = []\n  for entry in input_data:\n    for paragraph in entry[\"paragraphs\"]:\n      paragraph_text = paragraph[\"context\"]\n\n      for qa in paragraph[\"qas\"]:\n        qas_id = qa[\"id\"]\n        question_text = qa[\"question\"]\n        start_position = None\n        orig_answer_text = None\n        is_impossible = False\n\n        if is_training:\n          is_impossible = qa[\"is_impossible\"]\n          if (len(qa[\"answers\"]) != 1) and (not is_impossible):\n            raise ValueError(\n                \"For training, each question should have exactly 1 answer.\")\n          if not is_impossible:\n            answer = qa[\"answers\"][0]\n            orig_answer_text = answer[\"text\"]\n            start_position = answer[\"answer_start\"]\n          else:\n            start_position = -1\n            orig_answer_text = \"\"\n\n        example = SquadExample(\n            qas_id=qas_id,\n            question_text=question_text,\n            paragraph_text=paragraph_text,\n            orig_answer_text=orig_answer_text,\n            start_position=start_position,\n            is_impossible=is_impossible)\n        examples.append(example)\n","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/xlnet/squad_utils.py#L436-L472","documentation":"Error \"For training, each question should have exactly 1 answer.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/xlnet/squad_utils.py:454 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"}