[PR #14404] [CLOSED] fix: return defaultValue on parse error in BoolWithDefault #76953

Closed
opened 2026-05-05 09:41:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14404
Author: @tysoncung
Created: 2/25/2026
Status: Closed

Base: mainHead: fix/bool-with-default-fallback


📝 Commits (1)

  • 1d5a65a fix: return defaultValue on parse error in BoolWithDefault

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 envconfig/config.go (+1 -1)

📄 Description

Fixes #14389

BoolWithDefault returns true when strconv.ParseBool fails to parse the environment variable value, instead of returning defaultValue. This causes boolean feature flags to be silently enabled when a user sets an env var to a common-but-invalid string like "yes", "on", or "enabled".

The fix changes the error fallback from return true to return defaultValue, which is the intended behavior.


🔄 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/14404 **Author:** [@tysoncung](https://github.com/tysoncung) **Created:** 2/25/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/bool-with-default-fallback` --- ### 📝 Commits (1) - [`1d5a65a`](https://github.com/ollama/ollama/commit/1d5a65aac976a4bead523997758e125edfd41eb8) fix: return defaultValue on parse error in BoolWithDefault ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `envconfig/config.go` (+1 -1) </details> ### 📄 Description Fixes #14389 `BoolWithDefault` returns `true` when `strconv.ParseBool` fails to parse the environment variable value, instead of returning `defaultValue`. This causes boolean feature flags to be silently enabled when a user sets an env var to a common-but-invalid string like `"yes"`, `"on"`, or `"enabled"`. The fix changes the error fallback from `return true` to `return defaultValue`, which is the intended behavior. --- <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-05-05 09:41:11 -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#76953