[PR #12483] [MERGED] templates: fix crash in improperly defined templates #13836

Closed
opened 2026-04-13 00:38:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/12483
Author: @pdevine
Created: 10/3/2025
Status: Merged
Merged: 10/3/2025
Merged by: @pdevine

Base: mainHead: pdevine/template-fix


📝 Commits (1)

  • ba31b38 templates: fix crash in improperly defined templates

📊 Changes

3 files changed (+65 additions, -20 deletions)

View changed files

📝 server/images.go (+6 -2)
📝 template/template.go (+54 -17)
📝 template/template_test.go (+5 -1)

📄 Description

It's possible to pass in an improperly defined template which causes the server to crash when a model is being created. This fix propagates an error back from Identifiers() which is caught and returns a Bad Request error back to the caller.


🔄 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/12483 **Author:** [@pdevine](https://github.com/pdevine) **Created:** 10/3/2025 **Status:** ✅ Merged **Merged:** 10/3/2025 **Merged by:** [@pdevine](https://github.com/pdevine) **Base:** `main` ← **Head:** `pdevine/template-fix` --- ### 📝 Commits (1) - [`ba31b38`](https://github.com/ollama/ollama/commit/ba31b38ffc7bfa9aceea3a36c6ae3ee68946d8b6) templates: fix crash in improperly defined templates ### 📊 Changes **3 files changed** (+65 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `server/images.go` (+6 -2) 📝 `template/template.go` (+54 -17) 📝 `template/template_test.go` (+5 -1) </details> ### 📄 Description It's possible to pass in an improperly defined template which causes the server to crash when a model is being created. This fix propagates an error back from `Identifiers()` which is caught and returns a Bad Request error back to the caller. --- <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-13 00:38:13 -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#13836