{"record":{"id":"a166a97c4dad4ba2","repo":"tensorflow/models","slug":"the-value-extracted-with-keys-s-is-not-a-leaf-of","errorCode":null,"errorMessage":"The value extracted with keys: %s is not a leaf of the dictionary: %s.","messagePattern":"The value extracted with keys: (.+?) is not a leaf of the dictionary: (.+?)\\.","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"official/core/train_utils.py","lineNumber":66,"sourceCode":"    d: The dictionary to extract value from.\n    keys: The list of keys to extract values recursively.\n\n  Returns:\n    The value of the leaf.\n\n  Raises:\n    KeyError: If the value of keys extracted is a dictionary.\n  \"\"\"\n  leaf = d\n  for k in keys:\n    if not isinstance(leaf, dict) or k not in leaf:\n      raise KeyError(\n          'Path not exist while traversing the dictionary: d with keys'\n          ': %s.' % keys)\n    leaf = leaf[k]\n\n  if isinstance(leaf, dict):\n    raise KeyError('The value extracted with keys: %s is not a leaf of the '\n                   'dictionary: %s.' % (keys, d))\n  return leaf\n\n\ndef cast_leaf_nested_dict(d: Dict[str, Any],\n                          cast_fn: Callable[[Any], Any]) -> Dict[str, Any]:\n  \"\"\"Cast the leaves of a dictionary with arbitrary depth in place.\n\n  Args:\n    d: The dictionary to extract value from.\n    cast_fn: The casting function.\n\n  Returns:\n    A dictionray with the same structure as d.\n  \"\"\"\n  for key, value in d.items():\n    if isinstance(value, dict):\n      d[key] = cast_leaf_nested_dict(value, cast_fn)","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/core/train_utils.py#L48-L84","documentation":"Error \"The value extracted with keys: %s is not a leaf of the dictionary: %s.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/core/train_utils.py:66 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"}