[PR #14251] fix(cmd): check digest length before slicing in list command #25130

Open
opened 2026-04-19 18:01:00 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14251
Author: @BurakBebek1
Created: 2/14/2026
Status: 🔄 Open

Base: mainHead: fix/list-panic-error


📝 Commits (1)

  • 7fbe58a fix(cmd): check digest length before slicing in list command

📊 Changes

1 file changed (+5 additions, -1 deletions)

View changed files

📝 cmd/cmd.go (+5 -1)

📄 Description

This PR fixes a runtime panic in the list command when a model has a digest shorter than 12 characters. Added a length check before slicing.

Fixes #14250

Before the Development:

./ollama list
panic: runtime error: slice bounds out of range [:12] with length 3

goroutine 1 [running]:
github.com/ollama/ollama/cmd.ListHandler(0xc0004c8908, {0x24ca0a0, 0x0, 0x17d25fa?})
/home/turko/ollama/cmd/cmd.go:839 +0x559
github.com/spf13/cobra.(*Command).execute(0xc0004c8908, {0x24ca0a0, 0x0, 0x0})
/home/turko/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x85c
github.com/spf13/cobra.(*Command).ExecuteC(0xc000482f08)
/home/turko/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
/home/turko/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/spf13/cobra.(*Command).ExecuteContext(...)
/home/turko/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:985
main.main()
/home/turko/ollama/main.go:12 +0x4d

After the Development:

./ollama list
NAME ID SIZE MODIFIED
all-minilm:latest abc 45 MB 13 minutes ago

Type of Change: Bug fix
Testing: Manual verification by simulating a short digest (3 characters) to trigger the panic and verifying the fix.


🔄 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/14251 **Author:** [@BurakBebek1](https://github.com/BurakBebek1) **Created:** 2/14/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/list-panic-error` --- ### 📝 Commits (1) - [`7fbe58a`](https://github.com/ollama/ollama/commit/7fbe58a1d6d67cd1f103ced023aa3e30b82cc121) fix(cmd): check digest length before slicing in list command ### 📊 Changes **1 file changed** (+5 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+5 -1) </details> ### 📄 Description ### This PR fixes a runtime panic in the list command when a model has a digest shorter than 12 characters. Added a length check before slicing. Fixes #14250 --- ### Before the Development: ./ollama list panic: runtime error: slice bounds out of range [:12] with length 3 goroutine 1 [running]: github.com/ollama/ollama/cmd.ListHandler(0xc0004c8908, {0x24ca0a0, 0x0, 0x17d25fa?}) /home/turko/ollama/cmd/cmd.go:839 +0x559 github.com/spf13/cobra.(*Command).execute(0xc0004c8908, {0x24ca0a0, 0x0, 0x0}) /home/turko/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x85c github.com/spf13/cobra.(*Command).ExecuteC(0xc000482f08) /home/turko/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5 github.com/spf13/cobra.(*Command).Execute(...) /home/turko/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 github.com/spf13/cobra.(*Command).ExecuteContext(...) /home/turko/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:985 main.main() /home/turko/ollama/main.go:12 +0x4d --- ### After the Development: ./ollama list NAME ID SIZE MODIFIED all-minilm:latest abc 45 MB 13 minutes ago --- Type of Change: Bug fix Testing: Manual verification by simulating a short digest (3 characters) to trigger the panic and verifying the fix. --- <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-19 18:01:00 -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#25130