{"record":{"id":"6c380c0a60d41bfe","repo":"tensorflow/models","slug":"missing-required-key-input-tensor-in-input-dicti","errorCode":null,"errorMessage":"Missing required key `input_tensor` in input dictionary.","messagePattern":"Missing required key `input_tensor` in input dictionary\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/nlp/modeling/layers/transformer_encoder_block.py","lineNumber":618,"sourceCode":"      if len(inputs) == 2:\n        input_tensor, attention_mask = inputs\n        key_value = None\n      elif len(inputs) == 3:\n        input_tensor, key_value, attention_mask = inputs\n      else:\n        raise ValueError(\"Unexpected inputs to %s with length at %d\" %\n                         (self.__class__, len(inputs)))\n    elif isinstance(inputs, dict):\n      if not set(inputs.keys()).issubset(\n          set([\"input_tensor\", \"key_value_tensor\", \"attention_mask\"])\n      ):\n        raise ValueError(\n            f\"Unexpected keys in input dictionary to: {inputs.keys()}\"\n        )\n      try:\n        input_tensor = inputs[\"input_tensor\"]\n      except KeyError as e:\n        raise ValueError(\n            \"Missing required key `input_tensor` in input dictionary.\"\n        ) from e\n      key_value = inputs.get(\"key_value_tensor\", None)\n      attention_mask = inputs.get(\"attention_mask\", None)\n    else:\n      input_tensor, key_value, attention_mask = (inputs, None, None)\n\n    if output_range is None:\n      output_range = self._output_range\n    if output_range:\n      if self._norm_first:\n        source_tensor = input_tensor[:, 0:output_range, :]\n        if self._use_query_residual:\n          # `source_tensor` is only used for the residual connection.\n          source_tensor = self._apply_lowrank_query_projection(\n              source_tensor, attention_mask\n          )\n","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/nlp/modeling/layers/transformer_encoder_block.py#L600-L636","documentation":"Error \"Missing required key `input_tensor` in input dictionary.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/nlp/modeling/layers/transformer_encoder_block.py:618 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"}