[PR #14125] [CLOSED] parser: allow multiple spaces after PARAMETER and MESSAGE keywords #45774

Closed
opened 2026-04-25 01:25:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14125
Author: @4RH1T3CT0R7
Created: 2/6/2026
Status: Closed

Base: mainHead: fix/modelfile-whitespace-parsing


📝 Commits (3)

  • cbb89e4 parser: allow multiple spaces after PARAMETER and MESSAGE keywords
  • a3e2df5 parser: allow multiple spaces after PARAMETER and MESSAGE keywords
  • c938419 Merge remote-tracking branch 'origin/fix/modelfile-whitespace-parsing' into fix/modelfile-whitespace-parsing

📊 Changes

2 files changed (+43 additions, -7 deletions)

View changed files

📝 parser/parser.go (+15 -7)
📝 parser/parser_test.go (+28 -0)

📄 Description

The Modelfile parser's state machine failed when extra whitespace existed
between PARAMETER/MESSAGE keywords and their arguments. For example,
PARAMETER temperature 0.5 produced "unknown parameter ''" because the
empty buffer triggered a premature state transition.

Fix by checking if the buffer is empty when transitioning out of
stateParameter/stateMessage. When empty, stay in the current state to skip
leading whitespace instead of transitioning prematurely.

Fixes #13359


🔄 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/14125 **Author:** [@4RH1T3CT0R7](https://github.com/4RH1T3CT0R7) **Created:** 2/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/modelfile-whitespace-parsing` --- ### 📝 Commits (3) - [`cbb89e4`](https://github.com/ollama/ollama/commit/cbb89e4d0d91c2ff3ce5dfd2fdd06cb1d6a0ce00) parser: allow multiple spaces after PARAMETER and MESSAGE keywords - [`a3e2df5`](https://github.com/ollama/ollama/commit/a3e2df5b6bb63dbb39eb3e8a2b294872a0a4d453) parser: allow multiple spaces after PARAMETER and MESSAGE keywords - [`c938419`](https://github.com/ollama/ollama/commit/c938419819aeeeca4bcec714c1e995a63f85f2b5) Merge remote-tracking branch 'origin/fix/modelfile-whitespace-parsing' into fix/modelfile-whitespace-parsing ### 📊 Changes **2 files changed** (+43 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `parser/parser.go` (+15 -7) 📝 `parser/parser_test.go` (+28 -0) </details> ### 📄 Description The Modelfile parser's state machine failed when extra whitespace existed between PARAMETER/MESSAGE keywords and their arguments. For example, `PARAMETER temperature 0.5` produced "unknown parameter ''" because the empty buffer triggered a premature state transition. Fix by checking if the buffer is empty when transitioning out of stateParameter/stateMessage. When empty, stay in the current state to skip leading whitespace instead of transitioning prematurely. Fixes #13359 --- <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-25 01:25:08 -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#45774