{"record":{"id":"9e345487075538bb","repo":"tensorflow/models","slug":"exact-one-metric-must-be-present-but-0-are-pres","errorCode":null,"errorMessage":"Exact one metric must be present, but {0} are present.","messagePattern":"Exact one metric must be present, but (.+?) are present\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/volumetric_models/tasks/semantic_segmentation_3d.py","lineNumber":338,"sourceCode":"  def reduce_aggregated_logs(\n      self,\n      aggregated_logs: Optional[Mapping[str, Any]] = None,\n      global_step: Optional[tf.Tensor] = None) -> Mapping[str, float]:\n    \"\"\"Reduces logs to obtain per-class metrics if needed.\n\n    Args:\n      aggregated_logs: An optional dictionary containing aggregated logs.\n      global_step: An optional `tf.Tensor` of current global training steps.\n\n    Returns:\n      The reduced logs containing per-class metrics and overall metrics.\n\n    Raises:\n      ValueError: If `self.metrics` does not contain exactly 1 metric object.\n    \"\"\"\n    result = {}\n    if len(self.metrics) != 1:\n      raise ValueError('Exact one metric must be present, but {0} are '\n                       'present.'.format(len(self.metrics)))\n\n    metric = self.metrics[0].result().numpy()\n    if self.task_config.evaluation.report_per_class_metric:\n      for i, metric_val in enumerate(metric):\n        metric_name = self.metrics[0].name + '/class_{0}'.format(\n            i - 1) if i > 0 else self.metrics[0].name\n        result.update({metric_name: metric_val})\n    else:\n      result.update({self.metrics[0].name: metric})\n    return result\n","sourceCodeStart":320,"sourceCodeEnd":350,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/volumetric_models/tasks/semantic_segmentation_3d.py#L320-L350","documentation":"Error \"Exact one metric must be present, but {0} are present.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/volumetric_models/tasks/semantic_segmentation_3d.py:338 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"}