{"record":{"id":"131e9db7722617ea","repo":"tensorflow/models","slug":"the-key-does-not-exist-to-extend-the-existin","errorCode":null,"errorMessage":"The key `{}` does not exist. To extend the existing keys, use `override` with `is_strict` = False.","messagePattern":"The key `(.+?)` does not exist\\. To extend the existing keys, use `override` with `is_strict` = False\\.","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"official/modeling/hyperparams/params_dict.py","lineNumber":192,"sourceCode":"        False, keys in `override_params` can be different from what is currently\n        defined in the ParamsDict. In this case, the ParamsDict will be extended\n        to include the new keys.\n    \"\"\"\n    if self._locked:\n      raise ValueError('The ParamsDict has been locked. No change is allowed.')\n    if isinstance(override_params, ParamsDict):\n      override_params = override_params.as_dict()\n    self._override(override_params, is_strict)  # pylint: disable=protected-access\n\n  def _override(self, override_dict, is_strict=True):\n    \"\"\"The implementation of `override`.\"\"\"\n    for k, v in six.iteritems(override_dict):\n      if k in ParamsDict.RESERVED_ATTR:\n        raise KeyError('The key `%{}` is internally reserved. '\n                       'Can not be overridden.')\n      if k not in self.__dict__.keys():\n        if is_strict:\n          raise KeyError('The key `{}` does not exist. '\n                         'To extend the existing keys, use '\n                         '`override` with `is_strict` = False.'.format(k))\n        else:\n          logging.warning(\n              'Adding new key `%s` to ParamsDict because is_strict=False.', k\n          )\n          self._set(k, v)\n      else:\n        if isinstance(v, dict):\n          self.__dict__[k]._override(v, is_strict)  # pylint: disable=protected-access\n        elif isinstance(v, ParamsDict):\n          self.__dict__[k]._override(v.as_dict(), is_strict)  # pylint: disable=protected-access\n        else:\n          self.__dict__[k] = copy.deepcopy(v)\n\n  def lock(self):\n    \"\"\"Makes the ParamsDict immutable.\"\"\"\n    self._locked = True","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/modeling/hyperparams/params_dict.py#L174-L210","documentation":"Error \"The key `{}` does not exist. To extend the existing keys, use `override` with `is_strict` = False.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/modeling/hyperparams/params_dict.py:192 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"}