# Buggy code
def _update_params(self, params: dict):
    """Update experiment params files with the specified values."""
    from benedict import benedict

    from dvc.utils.serialize import MODIFIERS

    logger.debug("Using experiment params '%s'", params)

    for params_fname in params:
        path = PathInfo(self.repo.root_dir) / params_fname
        suffix = path.suffix.lower()
        modify_data = MODIFIERS[suffix]
        with modify_data(path, tree=self.repo.tree) as data:
            benedict(data).merge(params[params_fname], overwrite=True)

    # Force params file changes to be staged in git
    # Otherwise in certain situations the changes to params file may be
    # ignored when we `git stash` them since mtime is used to determine
    # whether the file is dirty
    self.scm.add(list(params.keys()))


# Traceback (FileNotFoundError)
Adding '.dvc/config.local' to '.dvc/.gitignore'.
Adding '.dvc/tmp' to '.dvc/.gitignore'.
Adding '.dvc/experiments' to '.dvc/.gitignore'.
Adding '.dvc/cache' to '.dvc/.gitignore'.
Check for update is enabled.
assuming default target 'dvc.yaml'.
fetched: [(3,)]
Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10as66'
Patching experiment workspace
Removing '/tmp/tmp8e9_4d6f'
Adding '.dvc/experiments/src/ai/training/.dvc/config.local' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'.
Adding '.dvc/experiments/src/ai/training/.dvc/tmp' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'.
Adding '.dvc/experiments/src/ai/training/.dvc/experiments' to '.dvc/experiments/src/ai/training/.dvc/.gitignore'.
Stashed experiment 'f951c9d' for future execution.
Reproducing experiment revs 'f951c9d'
Checking out experiment commit 'e6a4d8123aebe35a19b9e4544e21ac542a10s166'
Writing '/tmp/tmpmml3mawm/.dvc/config'.
Init local executor in dir '<TemporaryDirectory '/tmp/tmpmml3mawm'>' with baseline 'e6a4d81'.
Writing experiments local config '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local'
fetched: [(7583,)]
unexpected error - [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local'
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local'
------------------------------------------------------------
Traceback (most recent call last):
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/main.py", line 90, in main
ret = cmd.run()
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/command/experiments.py", line 469, in run
**self._repro_kwargs,
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 988, in run
return run(self.repo, *args, **kwargs)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/__init__.py", line 60, in wrapper
return f(repo, *args, **kwargs)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/run.py", line 62, in run
target=target, params=params, **kwargs
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 418, in reproduce_one
results = self.reproduce([stash_rev], keep_stash=False)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper
return f(exp, *args, **kwargs)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/__init__.py", line 593, in reproduce
checkpoint_reset=checkpoint_reset,
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 116, in __init__
self._config(cache_dir)
File "/home/elena/anaconda3/envs/myenv/lib/python3.6/site-packages/dvc/repo/experiments/executor.py", line 127, in _config
with open(local_config, "w") as fobj:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpmml3mawm/src/ai/training/.dvc/config.local'
------------------------------------------------------------
Adding '.dvc/config.local' to '.dvc/.gitignore'.
Adding '.dvc/tmp' to '.dvc/.gitignore'.
Adding '.dvc/experiments' to '.dvc/.gitignore'.
Adding '.dvc/cache' to '.dvc/.gitignore'.
Version info for developers:
DVC version: 1.10.2 (pip)
---------------------------------
Platform: Python 3.6.12 on Linux-5.4.0-48-generic-x86_64-with-debian-buster-sid
Supports: gs, http, https
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/nvme0n1p2
Caches: local
Remotes: local
Workspace directory: ext4 on /dev/nvme0n1p2
Repo: dvc (subdir), git

# Fixed code
def _update_params(self, params: dict):
    """Update experiment params files with the specified values."""
    from benedict import benedict

    from dvc.utils.serialize import MODIFIERS

    logger.debug("Using experiment params '%s'", params)

    for params_fname in params:
        path = PathInfo(params_fname)
        suffix = path.suffix.lower()
        modify_data = MODIFIERS[suffix]
        with modify_data(path, tree=self.repo.tree) as data:
            benedict(data).merge(params[params_fname], overwrite=True)

    # Force params file changes to be staged in git
    # Otherwise in certain situations the changes to params file may be
    # ignored when we `git stash` them since mtime is used to determine
    # whether the file is dirty
    self.scm.add(list(params.keys()))