{"record":{"id":"8afefcb9dfd24cf3","repo":"tensorflow/models","slug":"each-row-of-the-csv-label-map-file-must-be-in-id","errorCode":null,"errorMessage":"Each row of the csv label map file must be in `id,name` format. length = {}","messagePattern":"Each row of the csv label map file must be in `id,name` format\\. length = (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/dataloaders/tf_example_label_map_decoder.py","lineNumber":57,"sourceCode":"        tf.lookup.KeyValueTensorInitializer(\n            keys=tf.constant(list(name_to_id.keys()), dtype=tf.string),\n            values=tf.constant(list(name_to_id.values()), dtype=tf.int64)),\n        default_value=-1)\n\n  def _process_label_map(self, label_map):\n    if label_map.endswith('.csv'):\n      name_to_id = self._process_csv(label_map)\n    else:\n      raise ValueError('The label map file is in incorrect format.')\n    return name_to_id\n\n  def _process_csv(self, label_map):\n    name_to_id = {}\n    with tf.io.gfile.GFile(label_map, 'r') as f:\n      reader = csv.reader(f, delimiter=',')\n      for row in reader:\n        if len(row) != 2:\n          raise ValueError('Each row of the csv label map file must be in '\n                           '`id,name` format. length = {}'.format(len(row)))\n        id_index = int(row[0])\n        name = row[1]\n        name_to_id[name] = id_index\n    return name_to_id\n\n  def _decode_classes(self, parsed_tensors):\n    return self._name_to_id_table.lookup(\n        parsed_tensors['image/object/class/text'])\n","sourceCodeStart":39,"sourceCodeEnd":67,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/dataloaders/tf_example_label_map_decoder.py#L39-L67","documentation":"Error \"Each row of the csv label map file must be in `id,name` format. length = {}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/dataloaders/tf_example_label_map_decoder.py:57 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"}