# Buggy code
def _reproduce_stage(stage, **kwargs):
    def _run_callback(repro_callback):
        _dump_stage(stage)
        repro_callback([stage])

    checkpoint_func = kwargs.pop("checkpoint_func", None)
    if stage.is_checkpoint:
        if checkpoint_func:
            kwargs["checkpoint_func"] = partial(_run_callback, checkpoint_func)
        else:
            logger.warning(
                "Checkpoint stages are not fully supported in 'dvc repro'. "
                "Checkpoint stages should be reproduced with 'dvc exp run' "
                "or 'dvc exp resume'."
            )

    if stage.frozen and not stage.is_import:
        logger.warning(
            "{} is frozen. Its dependencies are not going to be reproduced.".format(
                stage
            )
        )

    stage = stage.reproduce(**kwargs)
    if not stage:
        return []

    if not kwargs.get("dry", False):
        _dump_stage(stage)

    return [stage]


# 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 _reproduce_stage(stage, **kwargs):
    def _run_callback(repro_callback):
        _dump_stage(stage)
        _track_stage(stage)
        repro_callback([stage])

    checkpoint_func = kwargs.pop("checkpoint_func", None)
    if stage.is_checkpoint:
        if checkpoint_func:
            kwargs["checkpoint_func"] = partial(_run_callback, checkpoint_func)
        else:
            logger.warning(
                "Checkpoint stages are not fully supported in 'dvc repro'. "
                "Checkpoint stages should be reproduced with 'dvc exp run' "
                "or 'dvc exp resume'."
            )

    if stage.frozen and not stage.is_import:
        logger.warning(
            "{} is frozen. Its dependencies are not going to be reproduced.".format(
                stage
            )
        )

    stage = stage.reproduce(**kwargs)
    if not stage:
        return []

    if not kwargs.get("dry", False):
        track = checkpoint_func is not None
        _dump_stage(stage)
        if track:
            _track_stage(stage)

    return [stage]