# Invalid length when restoring

**URL:** <https://kopia.discourse.group/t/invalid-length-when-restoring/1741>\
**Category:** Support\
**Created:** [January 25, 2023, 9:57am UTC](https://kopia.discourse.group/t/invalid-length-when-restoring/1741 "2023-01-25T09:57:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kinu](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kinu/32/576_2.png) [@kinu](https://kopia.discourse.group/u/kinu)\
**Post date:** [January 25, 2023, 9:57am UTC](https://kopia.discourse.group/t/invalid-length-when-restoring/1741/1 "2023-01-25T09:57:52Z")

</div>

Hello.

I’m testing KopiaUI in Windows for my backups. I successfully created two snapshots of my files.

The problem comes when I’m trying to restore. No matter what file or snapshot I choose, I’m always getting an “Invalid lenght” error.

Example:

`10:47:10.724 ignored error copy file: error creating file: unable to open snapshot file for c:\temp4\- CATALOGO COMPLETO BEEKLEY_26.pdf: unable to open object: c3057648dd101ad45a618be6702207a2: unexpected content error: error getting cached content: failed to get blob with ID p6eac87fe14b41b2a3ae15fe845e6268a-s68cdf9fcae62fba5118: invalid length 206470, expected 206471: invalid blob offset or length on - CATALOGO COMPLETO BEEKLEY_26.pdf`.

Same when restoring a bunch of files. When mounting and trying to copy a file, same error. Always 1 byte difference is shown.

I’ve connected from a linux desktop to the same repository, and I’m getting same error when trying to restore from there.

My repository is a webdav server, that is working ok for other tasks.

I’m using zstd-fastest compression for my files.

```auto
{
  "storage": {
    "type": "webdav",
    "config": {
      "url": "https://karadav.mydomain.com/files/myuser",
      "username": "myuser",
      "password": "mypassword",
      "atomicWrites": false,
      "dirShards": null
    }
  },
  "caching": {
    "cacheDirectory": "../../.cache/kopia/42364c4564e65b25",
    "maxCacheSize": 5242880000,
    "maxMetadataCacheSize": 5242880000,
    "maxListCacheDuration": 30
  },
  "hostname": "miguel-pc",
  "username": "miguel",
  "description": "biWEBDAV repo",
  "enableActions": false,
  "formatBlobCacheDuration": 900000000000
}

```

What am I missing?

EDIT: when checking the backup using `kopia content verify --download-percent=100` I’m getting this 1-byte difference for all files

```auto
ERROR error content 0657a195560fd57de6709a78664f9ac7 is invalid: error getting cached content: failed to get blob with ID p3773d929ecb2858187f146e6e53bb990-s68c
df9fcae62fba5118: invalid length 128557, expected 128558: invalid blob offset or length
ERROR error content 065a1ae57e868ae26188266c446279c8 is invalid: error getting cached content: failed to get blob with ID p37fcfd93f1f8c6640faabcd45484ad91-s68c
df9fcae62fba5118: invalid length 14660, expected 14661: invalid blob offset or length
ERROR error content 065980b0a8a5131a5743161d23c331fb is invalid: error getting cached content: failed to get blob with ID pfafc2a0283e42d458ddac12c0b89dfc3-s68c
df9fcae62fba5118: invalid length 199589, expected 199590: invalid blob offset or length
ERROR error content 065c98a9af23ddb650287dce267189b7 is invalid: error getting cached content: failed to get blob with ID p9de823cddd473d9e0eee53c81357d869-s2d1
07c327b5f711a118: invalid length 345435, expected 345436: invalid blob offset or length
ERROR error content 065b2bba7065e8269d7e38623a8d3d3f is invalid: error getting cached content: failed to get blob with ID pf7f7f77b24769b13d08506381bb01d6b-s2d1
07c327b5f711a118: invalid length 5434, expected 5435: invalid blob offset or length

```

---

<div class="post-metadata">

**Author:** ![IcePic](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@IcePic](https://kopia.discourse.group/u/IcePic)\
**Post date:** [January 25, 2023, 3:58pm UTC](https://kopia.discourse.group/t/invalid-length-when-restoring/1741/2 "2023-01-25T15:58:06Z")

</div>

If you are 100% sure other clients are not missing last byte when using same WebDav, then perhaps there is a bug in the webdav used by kopia that for some reason makes the last byte go missing.

---

<div class="post-metadata">

**Author:** ![kinu](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kinu/32/576_2.png) [@kinu](https://kopia.discourse.group/u/kinu)\
**Post date:** [January 26, 2023, 8:04am UTC](https://kopia.discourse.group/t/invalid-length-when-restoring/1741/3 "2023-01-26T08:04:29Z")

</div>

Thank you for your response.

The server is working. I have tested it using CrossFTP (WebDAV capable client). Connected to the same directory where the backup is stored, and uploading a file. Then renaming locally the file, downloading it and using diff. Both files remain the same.

So must be a bug, I think. Shoud I report it in Github issues? Is there any other test I can do to confirm this?

---

<div class="post-metadata">

**Author:** ![IcePic](https://avatars.discourse-cdn.com/v4/letter/i/74df32/32.png) [@IcePic](https://kopia.discourse.group/u/IcePic)\
**Post date:** [January 26, 2023, 10:00am UTC](https://kopia.discourse.group/t/invalid-length-when-restoring/1741/4 "2023-01-26T10:00:06Z")

</div>

Yes, you should definitely report it as a GH issue.  
I was wondering what kind of tests are being done with “kopia repository validate”, if it does write and read stuff back, and there is a bug in kopia-webdav, then it should show there too, I gather.

---

<div class="post-metadata">

**Author:** ![kinu](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/kinu/32/576_2.png) [@kinu](https://kopia.discourse.group/u/kinu)\
**Post date:** [January 26, 2023, 10:30am UTC](https://kopia.discourse.group/t/invalid-length-when-restoring/1741/5 "2023-01-26T10:30:49Z")

</div>

Done. [Last byte missing when using WebDAV repository](https://github.com/kopia/kopia/issues/2712)
