"List(key) returned error" when backing up to mapped smb drive from windows

I just set up restic through backrest and ran into a problem…

I have a local Windows PC with backrest & restic installation and a shared smb drive. The remote drive was mapped to S:// using windows file manager.

My restic version:

PS C:\Users\username> .\AppData\Local\Programs\Backrest\restic.exe version
restic 0.18.0 compiled with go1.24.1 on windows/amd64

using Backrests GUI, I created a repository with the following settings:

{
  "id": "RepoID",
  "guid": "...",
  "uri": "S:\\path\\to\\backup",
  "password": "...",
  "env": [],
  "flags": [],
  "prunePolicy": {
    "maxUnusedPercent": 10,
    "schedule": {
      "clock": "CLOCK_LOCAL",
      "cron": "0 12 * * 6"
    }
  },
  "checkPolicy": {
    "readDataSubsetPercent": 50,
    "schedule": {
      "clock": "CLOCK_LOCAL",
      "cron": "0 12 * * 0"
    }
  },
  "autoUnlock": false,
  "hooks": []
}

My Plan config:

{
  "id": "PlanID",
  "repo": "RepoID",
  "paths": [
    "D:\\"
  ],
  "excludes": [],
  "iexcludes": [],
  "schedule": {
    "clock": "CLOCK_LOCAL",
    "cron": "0 22 * * *"
  },
  "backup_flags": [],
  "retention": {
    "policyTimeBucketed": {
      "yearly": 0,
      "monthly": 12,
      "weekly": 0,
      "daily": 30,
      "hourly": 24,
      "keepLastN": 0
    }
  },
  "hooks": []
}

Upon the first (manual) test run, I receive the following errors:

[repo-manager] 08:30:56.534Z	debug	repo orchestrator starting backup	{"repo": "RepoName", "repo": "RepoName"}

[restic] 

[restic] command: ["C:\\Users\\username\\AppData\\Local\\Programs\\Backrest\\restic.exe" "snapshots" "--json" "-o" "sftp.args=-oBatchMode=yes" "--tag" "plan:PlanName,created-by:MyPC"]

[restic] List(key) returned error, retrying after 1.186618988s: GetFileInformationByHandleEx S:\path\to\backup\keys: Der angegebene Server kann den angeforderten Vorgang nicht ausführen.

... those messages reoccur with different timeouts ...

[restic] {"message_type":"exit_error","code":1,"message":"Fatal: GetFileInformationByHandleEx S:\\path\to\backup\\keys: Der angegebene Server kann den angeforderten Vorgang nicht ausführen."}

[tasklog] 08:44:40.671Z	error	backup for plan "PlanName"	task failed	{"error": "failed to get snapshots for plan: get snapshots for plan \"PlanName\": command \"C:\\\\Users\\\\username\\\\AppData\\\\Local\\\\Programs\\\\Backrest\\\\restic.exe snapshots --json -o sftp.args=-oBatchMo...\" failed: exit status 1\nOutput:\nList(key) returned error, retrying after 1.186618988s: GetFileInformationByHandleEx S:\\path\\to\\backup\\keys: Der angegebene Server kann den angeforderten Vorgang nicht ausführen.\n... 3152 bytes truncated ...\n", "duration": 824.1376919}

Has anybody encountered this problem?

I know backrest bundles a version of restic, but I would suggest to please reach out on their GitHub repository either in an issue or a discussion :slight_smile:

I tested the whole process with the official restic binary and it produced the same errors. Here are the details:

First, i downloaded the binary from github:

PS C:\Users\username\Downloads> .\restic_0.18.0_windows_amd64.exe version
restic 0.18.0 compiled with go1.24.1 on windows/amd64

The next step was the init of a repo:

PS C:\Users\username\Downloads> .\restic_0.18.0_windows_amd64.exe init --repo S:\path\on\remote\drive\backup_test\
enter password for new repository:
enter password again:
created restic repository f0c5bf5e05 at S:\path\on\remote\drive\backup_test\

Please note that knowledge of your password is required to access
the repository. Losing your password means that your data is
irrecoverably lost.

And then i ran a backup:

PS C:\Users\username\Downloads> .\restic_0.18.0_windows_amd64.exe -r S:\path\on\remote\drive\backup_test\ --verbose backup 'D:\Dokumente\folder_to_be_backed_up\'
open repository
enter password for repository:
List(key) returned error, retrying after 694.424355ms: GetFileInformationByHandleEx S:\path\on\remote\drive\backup_test\keys: Der angegebene Server kann den angeforderten Vorgang nicht ausführen.

... This repeats several times with increasing intervals ...

After pressing Ctrl+C:

wrong password or no key found. Try again
enter password for repository:                                                                                          signal interrupt received, cleaning up
context canceled

It seems as if this is unrelated to backrest. I also tried to backup to a repo on my local disk, which worked fine (using restic and backrest).

@whale
agree with your observation. Here is the relevant error:

List(key) returned error

Is the repository key file present? Verify the content of this folder, there should be one key file present:

S:\path\on\remote\drive\backup_test\keys

Also, which version of windows and smb protool do you use?

p.s. I made a test repo in Windows with restic 0.16.4 on a SMB 3.1.1 share but could not reproduce your error.

Hi all, I’m having a similar issue with restic but using a different setup:

I’m using restic on Ubuntu 24.04.2 LTS

restic version
restic 0.18.0 compiled with go1.24.1 on linux/amd64

Restic is backing up from the Ubuntu machine to a rclone Union consisting of multiple Microsoft Onedrives.

From one day to another (Jun 6th 2025 to Jun 7th 2025) I ran into the issue, that restic fails backing up with “Error 1”. Digging deeper I found out - no matter what restic command I would like to run - I get the following error:

Load(<key/9e74exxx81>, 0, 0) returned error, retrying after 1.084817419s: <key/9e78exxx81> does not exist
Load(<key/9e74exxx81>, 0, 0) returned error, retrying after 2.686743445s: <key/9e74exxx81> does not exist
Load(<key/9e74exxx81>, 0, 0) returned error, retrying after 5.727752011s: <key/9e74exxx81> does not exist
Load(<key/9e74exxx81>, 0, 0) returned error, retrying after 10.461167972s: <key/9e74exxx81> does not exist
...

after pressing CTRL+C it prints:

  signal interrupt received, cleaning up
Fatal: wrong password or no key found

The key file exists on one of the Onedrives and the SHA256 sum equals the filename. Moreover I can access this file via rclone, therefore I do not assume rclone being the reason for the error:

rclone ls onedrive_union:MACHINEXXX/storage/Backup/keys
      448 9e74exxx81ad6c685e29be0a2232feb6f35fbcb1a64b723d677b24788cbb03d2

I was wondering if the different filename compared to the filename of the key in the error message might cause the problems, but using a copy of the key with the shortened filename does not solve the problem.

At the moment I’m backing up the machine using an external harddrive I store outside my house, but this cannot be a permanent solution.

Since I’m struggling with this problem since more than a month now, and I could not find any solution up to now any hints are highly appreciated.

Yes, there is exactly one key file in this folder.

I’m running Windows 11 Pro, Version 24H2. Regarding the smb-protocol:

PS C:\Users\username> Get-SmbConnection

ServerName                        ShareName  UserName           Credential         Dialect NumOpens
----------                        ---------  --------           ----------        ------- --------
server.address.de                 ShareName1 PC-Name\username   PC-Name\username  3.0     3
server.address.de                 ShareName2 PC-Name\username   PC-Name\username  3.0     1

I had a short conversation with a colleague regarding this issue. He is using the same servers and ran into the same issue with restic. He’s now using restic inside a vera-crypt container on the smb-share, which seems to work well. According to him, the problem is a restricted file-lock-policy on the server.

Best regards!

GetFileInformationByHandleEx is used by the Go standard library when listing the contents of a folder. Basically your server is unable to list the contents of a directory that was opened via a file handle.

Relevant code snippet:

d, err := os.Open(dir)
// ...
sub, err := d.Readdirnames(-1)

In case you’re no Go programmer, that’s the simplest possible way to list the directory contents in Go. So it looks like the server is completely unusable with any Go program.

How exactly are you calling restic for the backup? Do you use the rclone backend?

I’m calling restic via a script:

…

PASSWORD=/pathtopw/password.txt

CACHE=/pathtocache/

EXCLUDE=/pathtoexcludes/excludes.txt

export REMOTE=rclone:onedrive_union:MACHINEXXX/storage/Backup 
...

restic -v -r $REMOTE -p $PASSWORD --cache-dir $CACHE backup $SOURCE --exclude-file $EXCLUDE
...

Does

rclone copy onedrive_union:MACHINEXXX/storage/Backup/keys localpath

work? You can also try using the latest version from GitHub - rclone/rclone: "rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files .