# ERROR: unexpected error - lost ssh-agent

**URL:** <https://discuss.dvc.org/t/error-unexpected-error-lost-ssh-agent/880>\
**Category:** Bug Reports\
**Created:** [September 7, 2021, 1:49pm UTC](https://discuss.dvc.org/t/error-unexpected-error-lost-ssh-agent/880 "2021-09-07T13:49:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chamroukhi](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@chamroukhi](https://discuss.dvc.org/u/chamroukhi)\
**Post date:** [September 7, 2021, 1:49pm UTC](https://discuss.dvc.org/t/error-unexpected-error-lost-ssh-agent/880/1 "2021-09-07T13:49:58Z")

</div>

Hi,  
I’m trying to clean dvc cache with this command` dvc gc -a` to keep cached data referenced in all Git branches, as well as in the workspace (implying `-w` ) but i got this error:

```auto
ERROR: unexpected error - lost ssh-agent

```

thanks for advance

---

<div class="post-metadata">

**Author:** ![daavoo](https://avatars.discourse-cdn.com/v4/letter/d/b4bc9f/32.png) [@daavoo](https://discuss.dvc.org/u/daavoo)\
**Post date:** [September 7, 2021, 2:00pm UTC](https://discuss.dvc.org/t/error-unexpected-error-lost-ssh-agent/880/2 "2021-09-07T14:00:22Z")

</div>

Hi @chamroukhi . Could you share the output of running `dvc gc -a -v` (Adding the `-v` option)?

---

<div class="post-metadata">

**Author:** ![chamroukhi](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@chamroukhi](https://discuss.dvc.org/u/chamroukhi)\
**Post date:** [September 7, 2021, 2:04pm UTC](https://discuss.dvc.org/t/error-unexpected-error-lost-ssh-agent/880/3 "2021-09-07T14:04:00Z")

</div>

> [@daavoo](#):
>
> `dvc gc -a -v`

````auto

2021-09-07 14:01:59,619 WARNING: This will remove all cache except items used in the workspace and all git branches of the current repo.
Are you sure you want to proceed? [y/n] y
2021-09-07 14:02:11,157 DEBUG: Preparing to download data from 'ssh://nchamroukhi@192.168.14.4/mnt/data/dcv_remote_storage/gifs_project'
2021-09-07 14:02:11,157 DEBUG: Preparing to collect status from ssh://nchamroukhi@192.168.14.4/mnt/data/dcv_remote_storage/gifs_project
2021-09-07 14:02:11,158 DEBUG: Collecting information from local cache...
2021-09-07 14:02:11,158 DEBUG: Collecting information from remote cache...                                                                        
2021-09-07 14:02:11,159 DEBUG: Matched '0' indexed hashes
2021-09-07 14:02:11,161 DEBUG: Establishing ssh connection with '192.168.14.4' through port '22' as user 'nchamroukhi'                            
2021-09-07 14:02:11,270 ERROR: unexpected error - lost ssh-agent                                                                                  
------------------------------------------------------------
Traceback (most recent call last):
  File "dvc/output.py", line 796, in get_dir_cache
  File "dvc/objects/ __init__.py", line 35, in check
  File "dvc/objects/db/base.py", line 133, in check
  File "dvc/objects/file.py", line 51, in check
  File "dvc/objects/stage.py", line 56, in get_file_hash
FileNotFoundError: [Errno 2] No such file or directory: '/root/workspace/shared_cache/gifs_project/3a/b5e7da41fa9686abd87b978373aec5.dir'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "dvc/main.py", line 55, in main
  File "dvc/command/base.py", line 50, in do_run
  File "dvc/command/gc.py", line 50, in run
  File "dvc/repo/ __init__.py", line 50, in wrapper
  File "dvc/repo/gc.py", line 62, in gc
  File "dvc/repo/ __init__.py", line 395, in used_cache
  File "dvc/stage/ __init__.py", line 630, in get_used_cache
  File "dvc/output.py", line 911, in get_used_cache
  File "dvc/output.py", line 836, in collect_used_dir_cache
  File "dvc/output.py", line 798, in get_dir_cache
  File "dvc/data_cloud.py", line 84, in pull
  File "dvc/remote/base.py", line 56, in wrapper
  File "dvc/remote/base.py", line 484, in pull
  File "dvc/remote/base.py", line 321, in _process
  File "dvc/remote/base.py", line 173, in _status
  File "dvc/remote/base.py", line 130, in hashes_exist
  File "dvc/objects/db/ssh.py", line 73, in hashes_exist
  File "concurrent/futures/_base.py", line 619, in result_iterator
  File "concurrent/futures/_base.py", line 444, in result
  File "concurrent/futures/_base.py", line 389, in __get_result
  File "concurrent/futures/thread.py", line 57, in run
  File "dvc/objects/db/ssh.py", line 64, in exists_with_progress
  File "dvc/objects/db/ssh.py", line 31, in batch_exists
  File "contextlib.py", line 113, in __enter__
  File "dvc/fs/pool.py", line 11, in get_connection
  File "dvc/fs/pool.py", line 53, in get_connection
  File "dvc/fs/ssh/connection.py", line 59, in __init__
  File "paramiko/client.py", line 435, in connect
  File "paramiko/client.py", line 691, in _auth
  File "paramiko/agent.py", line 379, in __init__
  File "paramiko/agent.py", line 65, in _connect
  File "paramiko/agent.py", line 83, in _send_message
  File "paramiko/agent.py", line 91, in _read_all
paramiko.ssh_exception.SSHException: lost ssh-agent
------------------------------------------------------------
2021-09-07 14:02:12,222 DEBUG: Version info for developers:
DVC version: 2.3.0 (deb)
---------------------------------
Platform: Python 3.8.10 on Linux-5.11.0-27-generic-x86_64-with-glibc2.7
Supports: All remotes
Cache types: symlink
Cache directory: ext4 on /dev/nvme0n1p2
Caches: local
Remotes: ssh, ssh, ssh
Workspace directory: ext4 on /dev/nvme0n1p2
Repo: dvc, git

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
2021-09-07 14:02:12,223 DEBUG: Analytics is enabled.
2021-09-07 14:02:12,303 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmpi805iiq5']'
2021-09-07 14:02:12,306 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmpi805iiq5']'```
````
