{"record":{"id":"be5d20862723d095","repo":"tensorflow/models","slug":"unknown-file-type-file-type","errorCode":null,"errorMessage":"Unknown file_type: {file_type}","messagePattern":"Unknown file_type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/core/file_writers.py","lineNumber":49,"sourceCode":"\n  Args:\n    examples: List of tf.train.Example or tf.train.SequenceExample.\n    output_path: Output path for the dataset.\n    file_type: A string indicating the file format, could be: 'tfrecord',\n      'tfrecords', 'tfrecord_compressed', 'tfrecords_gzip', 'riegeli'. The\n      string is case insensitive.\n  \"\"\"\n  file_type = file_type.lower()\n\n  if file_type == 'tfrecord' or file_type == 'tfrecords':\n    _write_tfrecord(examples, output_path)\n  elif file_type == 'tfrecord_compressed' or file_type == 'tfrecords_gzip':\n    _write_tfrecord(examples, output_path,\n                    tf.io.TFRecordOptions(compression_type='GZIP'))\n  elif file_type == 'riegeli':\n    _write_riegeli(examples, output_path)\n  else:\n    raise ValueError(f'Unknown file_type: {file_type}')\n\n\ndef _write_tfrecord(examples: Sequence[Union[tf.train.Example,\n                                             tf.train.SequenceExample]],\n                    output_path: str,\n                    options: Optional[tf.io.TFRecordOptions] = None) -> None:\n  \"\"\"Writes `examples` to a TFRecord file at `output_path`.\n\n  Args:\n    examples: A list of tf.train.Example.\n    output_path: Output path for the dataset.\n    options: Options used for manipulating TFRecord files.\n  \"\"\"\n  with tf.io.TFRecordWriter(output_path, options) as writer:\n    for example in examples:\n      writer.write(example.SerializeToString())\n\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/core/file_writers.py#L31-L67","documentation":"Error \"Unknown file_type: {file_type}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/core/file_writers.py:49 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"}