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

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

    # recursive dict update
    def _update(dict_, other):
        for key, value in other.items():
            if isinstance(value, Mapping):
                dict_[key] = _update(dict_.get(key, {}), value)
            else:
                dict_[key] = value
        return dict_

    for params_fname in params:
        path = PathInfo(self.exp_dvc.root_dir) / params_fname
        suffix = path.suffix.lower()
        modify_data = MODIFIERS[suffix]
        with modify_data(path, tree=self.exp_dvc.tree) as data:
            _update(data, params[params_fname])

    # 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 (AttributeError)
2020-10-21 16:59:00,192 ERROR: unexpected error - 'CommentedSeq' object has no attribute 'get'
------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/dvc/main.py", line 76, in main
ret = cmd.run()
File "/usr/local/lib/python3.8/dist-packages/dvc/command/experiments.py", line 419, in run
self.repo.experiments.run(
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 801, in run
return run(self.repo, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/__init__.py", line 51, in wrapper
return f(repo, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/run.py", line 62, in run
return repo.experiments.reproduce_one(
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 345, in reproduce_one
stash_rev = self.new(**kwargs)
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 38, in wrapper
return f(exp, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 407, in new
stash_rev = self._stash_exp(
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 265, in _stash_exp
self._update_params(params)
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 309, in _update_params
_update(data, params[params_fname])
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update
dict_[key] = _update(dict_.get(key, {}), value)
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update
dict_[key] = _update(dict_.get(key, {}), value)
File "/usr/local/lib/python3.8/dist-packages/dvc/repo/experiments/__init__.py", line 299, in _update
dict_[key] = _update(dict_.get(key, {}), value)
[Previous line repeated 1 more time]
AttributeError: 'CommentedSeq' object has no attribute 'get'
------------------------------------------------------------
2020-10-21 16:59:00,284 DEBUG: Version info for developers:
DVC version: 1.8.4 (pip)
---------------------------------
Platform: Python 3.8.0 on Linux-5.4.0-51-generic-x86_64-with-glibc2.27
Supports: http, https, s3
Cache types: hardlink, symlink
Repo: dvc, git

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

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

    # recursive dict update
    def _update(dict_, other):
        for key, value in other.items():
            if isinstance(dict_, list) and key.isdigit():
                key = int(key)
            if isinstance(value, Mapping):
                if isinstance(dict_, list):
                    fallback_value = dict_[key]
                else:
                    fallback_value = dict_.get(key, {})
                dict_[key] = _update(fallback_value, value)
            else:
                dict_[key] = value
        return dict_

    for params_fname in params:
        path = PathInfo(self.exp_dvc.root_dir) / params_fname
        suffix = path.suffix.lower()
        modify_data = MODIFIERS[suffix]
        with modify_data(path, tree=self.exp_dvc.tree) as data:
            _update(data, params[params_fname])

    # 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()))