{"record":{"id":"cb1727240927f721","repo":"tensorflow/models","slug":"at-least-one-input-is-required-for-packing","errorCode":null,"errorMessage":"At least one input is required for packing","messagePattern":"At least one input is required for packing","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/layers/text_layers.py","lineNumber":564,"sourceCode":"        start_of_sequence_id=self.start_of_sequence_id,\n        end_of_segment_id=self.end_of_segment_id,\n        padding_id=self.padding_id,\n        truncator=self.truncator)\n\n  @staticmethod\n  def bert_pack_inputs(inputs: Union[tf.RaggedTensor, List[tf.RaggedTensor]],\n                       seq_length: Union[int, tf.Tensor],\n                       start_of_sequence_id: Union[int, tf.Tensor],\n                       end_of_segment_id: Union[int, tf.Tensor],\n                       padding_id: Union[int, tf.Tensor],\n                       truncator=\"round_robin\"):\n    \"\"\"Freestanding equivalent of the BertPackInputs layer.\"\"\"\n    _check_if_tf_text_installed()\n    # Sanitize inputs.\n    if not isinstance(inputs, (list, tuple)):\n      inputs = [inputs]\n    if not inputs:\n      raise ValueError(\"At least one input is required for packing\")\n    input_ranks = [rt.shape.rank for rt in inputs]\n    if None in input_ranks or len(set(input_ranks)) > 1:\n      raise ValueError(\"All inputs for packing must have the same known rank, \"\n                       \"found ranks \" + \",\".join(input_ranks))\n    # Flatten inputs to [batch_size, (tokens)].\n    if input_ranks[0] > 2:\n      inputs = [rt.merge_dims(1, -1) for rt in inputs]\n    # In case inputs weren't truncated (as they should have been),\n    # fall back to some ad-hoc truncation.\n    num_special_tokens = len(inputs) + 1\n    if truncator == \"round_robin\":\n      trimmed_segments = text.RoundRobinTrimmer(seq_length -  # pyrefly: ignore[missing-attribute]\n                                                num_special_tokens).trim(inputs)\n    elif truncator == \"waterfall\":\n      trimmed_segments = text.WaterfallTrimmer(  # pyrefly: ignore[missing-attribute]\n          seq_length - num_special_tokens).trim(inputs)\n    else:\n      raise ValueError(\"Unsupported truncator: %s\" % truncator)","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/layers/text_layers.py#L546-L582","documentation":"Error \"At least one input is required for packing\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/layers/text_layers.py:564 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"}