[PR #15426] fix: handle os.MkdirAll errors in download and quantize #61851

Open
opened 2026-04-29 16:51:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15426
Author: @sjhddh
Created: 4/8/2026
Status: 🔄 Open

Base: mainHead: fix/mkdirall-error-handling


📝 Commits (1)

  • a506b16 fix: handle os.MkdirAll errors in download and quantize

📊 Changes

2 files changed (+24 additions, -8 deletions)

View changed files

📝 x/create/client/quantize.go (+21 -7)
📝 x/imagegen/transfer/download.go (+3 -1)

📄 Description

Summary

os.MkdirAll errors were silently ignored in two places, causing confusing downstream failures:

  • x/imagegen/transfer/download.go (line 179): The ignored error from os.MkdirAll(filepath.Dir(dest), 0o755) caused the subsequent os.Create(tmp) call to fail with a misleading no such file or directory instead of a clear directory-creation error. Wrapped with a fmt.Errorf and returned early.

  • x/create/client/quantize.go (line 446): ensureTempDir() silently swallowed the MkdirAll error and returned the path regardless. Changed the function signature from () string to () (string, error), and propagated the error through all four call sites (loadAndQuantizeArray, quantizeTensor, quantizePackedGroup, stackAndQuantizeExpertGroup).

Consistency with existing codebase

The rest of the codebase already handles MkdirAll errors correctly — for example, server/images.go lines 415, 668, and 765 all check and return the error. This change brings the two missing cases in line with that pattern.

Changes

  • No logic changes — pure error propagation.
  • Minimal diff: only the two files involved in the bug.

🔄 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/15426 **Author:** [@sjhddh](https://github.com/sjhddh) **Created:** 4/8/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/mkdirall-error-handling` --- ### 📝 Commits (1) - [`a506b16`](https://github.com/ollama/ollama/commit/a506b163ef4e210346d21353aec530319e3a3012) fix: handle os.MkdirAll errors in download and quantize ### 📊 Changes **2 files changed** (+24 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `x/create/client/quantize.go` (+21 -7) 📝 `x/imagegen/transfer/download.go` (+3 -1) </details> ### 📄 Description ## Summary `os.MkdirAll` errors were silently ignored in two places, causing confusing downstream failures: - **`x/imagegen/transfer/download.go` (line 179):** The ignored error from `os.MkdirAll(filepath.Dir(dest), 0o755)` caused the subsequent `os.Create(tmp)` call to fail with a misleading `no such file or directory` instead of a clear directory-creation error. Wrapped with a `fmt.Errorf` and returned early. - **`x/create/client/quantize.go` (line 446):** `ensureTempDir()` silently swallowed the `MkdirAll` error and returned the path regardless. Changed the function signature from `() string` to `() (string, error)`, and propagated the error through all four call sites (`loadAndQuantizeArray`, `quantizeTensor`, `quantizePackedGroup`, `stackAndQuantizeExpertGroup`). ## Consistency with existing codebase The rest of the codebase already handles `MkdirAll` errors correctly — for example, `server/images.go` lines 415, 668, and 765 all check and return the error. This change brings the two missing cases in line with that pattern. ## Changes - No logic changes — pure error propagation. - Minimal diff: only the two files involved in the bug. --- <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-29 16:51:14 -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#61851