[GH-ISSUE #7057] Logic in the Error Message Detection llm/status.go #50991

Open
opened 2026-04-28 17:45:41 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @vignesh1507 on GitHub (Oct 1, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7057

What is the issue?

The way the error message is being set in the Write method is a bit problematic. Specifically, the bytes.Cut function only finds the first occurrence of the prefix in the slice, and the error message is built only for that specific occurrence. If there are multiple error messages or prefixes, only the last match will be recorded in w.LastErrMsg.

The current logic doesn't break out of the loop once an error prefix is found. Instead, it continues checking, which is unnecessary once an error has already been detected.

Improvement: Add a break to stop after the first error match.

OS

macOS

GPU

Apple

CPU

Apple

Ollama version

3.1

Originally created by @vignesh1507 on GitHub (Oct 1, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7057 ### What is the issue? The way the error message is being set in the Write method is a bit problematic. Specifically, the bytes.Cut function only finds the first occurrence of the prefix in the slice, and the error message is built only for that specific occurrence. If there are multiple error messages or prefixes, only the last match will be recorded in w.LastErrMsg. The current logic doesn't break out of the loop once an error prefix is found. Instead, it continues checking, which is unnecessary once an error has already been detected. **Improvement**: Add a break to stop after the first error match. ### OS macOS ### GPU Apple ### CPU Apple ### Ollama version 3.1
GiteaMirror added the bug label 2026-04-28 17:45:41 -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#50991