[PR #4965] [MERGED] fix: skip removing layers that no longer exist #11631

Closed
opened 2026-04-12 23:34:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/4965
Author: @mxyng
Created: 6/10/2024
Status: Merged
Merged: 6/10/2024
Merged by: @mxyng

Base: mainHead: mxyng/skip-layer-remove


📝 Commits (2)

  • b27268a add test
  • 515f497 fix: skip removing layers that no longer exist

📊 Changes

2 files changed (+37 additions, -1 deletions)

View changed files

📝 server/manifest.go (+4 -1)
📝 server/routes_delete_test.go (+33 -0)

📄 Description

some models, such as wizardcoder:34b-python, incorrectly includes the config layer as an item in layers. this causes RemoveLayers to try to remove the same layer more than once, failing the second time since it's already removed

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
  "config": {
    "mediaType": "application/vnd.docker.container.image.v1+json",
    "digest": "sha256:a168bedb9a09640289c5174690a6221adae48b75dc431a219923f052ef20d0af",
    "size": 456
  },
  "layers": [
    {
      "mediaType": "application/vnd.ollama.image.model",
      "digest": "sha256:c8ad30822293b3c24f02265a42e2879b9725bd19a54d048fbe2c38487ee0ea84",
      "size": 19052059872
    },
    {
      "mediaType": "application/vnd.ollama.image.template",
      "digest": "sha256:2d836d77287d85ac3d2ea87f4d765db6aaabc98543442072111b3d9831cdf9f1",
      "size": 61
    },
    {
      "mediaType": "application/vnd.ollama.image.system",
      "digest": "sha256:8fadb9ad1206f2f130b54004893a2a7f76b1ff41a78049d69d797df2ee67fe94",
      "size": 106
    },
    {
      "mediaType": "application/vnd.ollama.image.params",
      "digest": "sha256:bf6237d30a42b25b196a7a178dc566e113cf2f193aa11e7302c6d61880be6028",
      "size": 30
    },
    {
      "mediaType": "application/vnd.docker.container.image.v1+json",
      "digest": "sha256:a168bedb9a09640289c5174690a6221adae48b75dc431a219923f052ef20d0af",
      "size": 456
    }
  ]
}

resolves #4898


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/4965 **Author:** [@mxyng](https://github.com/mxyng) **Created:** 6/10/2024 **Status:** ✅ Merged **Merged:** 6/10/2024 **Merged by:** [@mxyng](https://github.com/mxyng) **Base:** `main` ← **Head:** `mxyng/skip-layer-remove` --- ### 📝 Commits (2) - [`b27268a`](https://github.com/ollama/ollama/commit/b27268aaefa03f401f0f09c1e21b63872288ddc7) add test - [`515f497`](https://github.com/ollama/ollama/commit/515f497e6d5c0a102f913693fc8d4ed5eefd4ebb) fix: skip removing layers that no longer exist ### 📊 Changes **2 files changed** (+37 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `server/manifest.go` (+4 -1) 📝 `server/routes_delete_test.go` (+33 -0) </details> ### 📄 Description some models, such as `wizardcoder:34b-python`, incorrectly includes the config layer as an item in layers. this causes `RemoveLayers` to try to remove the same layer more than once, failing the second time since it's already removed ```json { "schemaVersion": 2, "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "config": { "mediaType": "application/vnd.docker.container.image.v1+json", "digest": "sha256:a168bedb9a09640289c5174690a6221adae48b75dc431a219923f052ef20d0af", "size": 456 }, "layers": [ { "mediaType": "application/vnd.ollama.image.model", "digest": "sha256:c8ad30822293b3c24f02265a42e2879b9725bd19a54d048fbe2c38487ee0ea84", "size": 19052059872 }, { "mediaType": "application/vnd.ollama.image.template", "digest": "sha256:2d836d77287d85ac3d2ea87f4d765db6aaabc98543442072111b3d9831cdf9f1", "size": 61 }, { "mediaType": "application/vnd.ollama.image.system", "digest": "sha256:8fadb9ad1206f2f130b54004893a2a7f76b1ff41a78049d69d797df2ee67fe94", "size": 106 }, { "mediaType": "application/vnd.ollama.image.params", "digest": "sha256:bf6237d30a42b25b196a7a178dc566e113cf2f193aa11e7302c6d61880be6028", "size": 30 }, { "mediaType": "application/vnd.docker.container.image.v1+json", "digest": "sha256:a168bedb9a09640289c5174690a6221adae48b75dc431a219923f052ef20d0af", "size": 456 } ] } ``` resolves #4898 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:34:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#11631