[PR #11436] fix: initialize Options map in GetModel to prevent nil panic #44788

Open
opened 2026-04-25 00:27:32 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/11436
Author: @williballenthin
Created: 7/15/2025
Status: 🔄 Open

Base: mainHead: fix-nil-options-panic


📝 Commits (2)

  • aee5f2c fix: initialize Options map in GetModel to prevent nil panic
  • fc65191 fix: ensure Options map in GetModelInfo is initialized

📊 Changes

2 files changed (+5 additions, -0 deletions)

View changed files

📝 server/images.go (+1 -0)
📝 server/routes.go (+4 -0)

📄 Description

Initialize the Options map when creating a new Model struct to prevent "assignment to entry in nil map" panics. This fixes a panic that occurs when models don't have params layers in their manifest.

I encountered this when doing:

❯ ollama run devstral
>>> /set parameter stop <|endoftext|>
Set parameter 'stop' to '<|endoftext|>'
>>> /set parameter num_ctx 131072
Set parameter 'num_ctx' to '131072'
>>> /show info
error: couldn't get model
Error: something went wrong, please see the ollama server logs for details

Closes #6890


🔄 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/11436 **Author:** [@williballenthin](https://github.com/williballenthin) **Created:** 7/15/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-nil-options-panic` --- ### 📝 Commits (2) - [`aee5f2c`](https://github.com/ollama/ollama/commit/aee5f2c1926f27a791a9711a8519b2462099f903) fix: initialize Options map in GetModel to prevent nil panic - [`fc65191`](https://github.com/ollama/ollama/commit/fc65191b292b66a6cee0202fd87bbbfd1bbb8571) fix: ensure Options map in GetModelInfo is initialized ### 📊 Changes **2 files changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `server/images.go` (+1 -0) 📝 `server/routes.go` (+4 -0) </details> ### 📄 Description Initialize the Options map when creating a new Model struct to prevent "assignment to entry in nil map" panics. This fixes a panic that occurs when models don't have params layers in their manifest. I encountered this when doing: ```console ❯ ollama run devstral >>> /set parameter stop <|endoftext|> Set parameter 'stop' to '<|endoftext|>' >>> /set parameter num_ctx 131072 Set parameter 'num_ctx' to '131072' >>> /show info error: couldn't get model Error: something went wrong, please see the ollama server logs for details ``` Closes #6890 --- <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 00:27:32 -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#44788