[PR #14286] cmd: fix panic when model digest is shorter than 12 characters #14602

Open
opened 2026-04-13 00:58:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14286
Author: @quantumnic
Created: 2/16/2026
Status: 🔄 Open

Base: mainHead: fix/bugfixes


📝 Commits (1)

  • 414ea61 cmd: fix panic when model digest is shorter than 12 characters

📊 Changes

2 files changed (+11 additions, -3 deletions)

View changed files

📝 cmd/cmd.go (+10 -2)
📝 docs/faq.mdx (+1 -1)

📄 Description

Summary

Two bug fixes:

1. Fix panic in ollama list / ollama ps with short digests (Fixes #14250)

ListHandler and ProcessHandler unconditionally slice m.Digest[:12] without checking the string length. If a model has a digest shorter than 12 characters (e.g. malformed manifest), this causes:

panic: runtime error: slice bounds out of range [:12] with length 3

Fix: Add a bounds check before slicing — show the full digest if it's shorter than 12 characters.

The FAQ links to ./gpu.mdx which results in a 404 on the docs site. Changed to ./gpu to match the docs routing.

Testing

  • Verified the digest slicing logic handles short strings correctly
  • Verified the docs link format matches other working links in the docs

🔄 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/14286 **Author:** [@quantumnic](https://github.com/quantumnic) **Created:** 2/16/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/bugfixes` --- ### 📝 Commits (1) - [`414ea61`](https://github.com/ollama/ollama/commit/414ea615cfe2b05ced8d962bb7fefed5b76a5ac1) cmd: fix panic when model digest is shorter than 12 characters ### 📊 Changes **2 files changed** (+11 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+10 -2) 📝 `docs/faq.mdx` (+1 -1) </details> ### 📄 Description ## Summary Two bug fixes: ### 1. Fix panic in `ollama list` / `ollama ps` with short digests (Fixes #14250) `ListHandler` and `ProcessHandler` unconditionally slice `m.Digest[:12]` without checking the string length. If a model has a digest shorter than 12 characters (e.g. malformed manifest), this causes: ``` panic: runtime error: slice bounds out of range [:12] with length 3 ``` **Fix:** Add a bounds check before slicing — show the full digest if it's shorter than 12 characters. ### 2. Fix broken GPU docs link in FAQ (Fixes #14243) The FAQ links to `./gpu.mdx` which results in a 404 on the docs site. Changed to `./gpu` to match the docs routing. ## Testing - Verified the digest slicing logic handles short strings correctly - Verified the docs link format matches other working links in the docs --- <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-13 00:58:56 -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#14602