Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

ollamarunner: Suppress stack trace during memory allocation

Jesse Gross26214125e86a
diff --git a/runner/ollamarunner/runner.go b/runner/ollamarunner/runner.go
index 201d55a16..676e5186f 100644
--- a/runner/ollamarunner/runner.go
+++ b/runner/ollamarunner/runner.go
@@ -18,7 +18,6 @@ import (
"reflect"
"regexp"
"runtime"
- "runtime/debug"
"strconv"
"strings"
"sync"
@@ -1101,9 +1100,13 @@ func (s *Server) allocModel(
// Convert memory allocation panics to errors
defer func() {
if r := recover(); r != nil {
- debug.PrintStack()
if err, ok := r.(error); ok {
- panicErr = err
+ var noMem ml.ErrNoMem
+ if errors.As(err, &noMem) {
+ panicErr = noMem
+ } else {
+ panic(r)
+ }
} else {
panic(r)
}