sammcj / gollama

Go manage your Ollama models
https://smcleod.net
MIT License
369 stars 26 forks source link

🐞 Bug: Panic: runtime error in getAPIUrl() - Slice bounds out of range #105

Closed no1etal closed 2 days ago

no1etal commented 1 week ago

Description: I encountered a runtime panic when running the gollama application. The error occurs due to an out-of-bounds slice operation in the getAPIUrl() function within config.go. This issue causes the application to crash when trying to slice a string or array beyond its length.

Steps to Reproduce:

Run the gollama application
The application crashes with the following error message:

panic: runtime error: slice bounds out of range [:8] with length 7

goroutine 1 [running]:
github.com/sammcj/gollama/config.getAPIUrl()
    /home/kopachke/go/pkg/mod/github.com/sammcj/gollama@v1.27.3/config/config.go:46 +0xbd
github.com/sammcj/gollama/config.init()
    /home/kopachke/go/pkg/mod/github.com/sammcj/gollama@v1.27.3/config/config.go:31 +0xf

Environment:

Gollama Version: v1.27.3
Go Version: go1.23.0 linux/amd64
OS: arch
sammcj commented 1 week ago

Interesting!

What's in your ~/.config/gollama/config.json? (remember to redact any keys before sharing)

And the value of your $OLLAMA_HOST if possible?

sammcj commented 1 week ago

I've got a potential fix on the way for what I suspect it is. https://github.com/sammcj/gollama/pull/108

sammcj commented 1 week ago

Could you please install the latest version and let me know if that fixes it @no1etal ?