Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

macOS / Apple M5: all models fail to load with 500 error due to Metal backend crash (bfloat/half mismatch in ggml_metal_library_init)

オープン
#643 コメント 4 件 リアクション 2 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
macos

調査の方向性

まず macOS Apple M5 で ollama run nemotron-3-nano:4b を使って失敗を再現し、ggml_metal_library_init 周辺の runner ログを調査します。報告されている bfloat/half の不一致を通る Metal の初期化経路を追跡し、runner が中断せずに初期化できるか確認します。モデルが正常に読み込まれるか、HTTP 500 を返す代わりに runner が適切にフォールバックすれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

What happened?
Since today, Ollama stopped loading any model at all on my Mac. Initially I suspected a corrupted model state after a memory exhaustion / crash situation, because earlier I had been experimenting with a model and pushed RAM usage close to the limit.

After that incident, I had to reboot the machine. Since then, every model fails to load, including very small ones.

At first I thought it might be similar to this issue:

https://github.com/ollama/ollama/issues/15410
However, after checking manifests/blobs and then doing a full reinstall plus deleting ~/.ollama, the problem still persists.

The error is always:

bash

Collapse
Save
Copy
1
Error: 500 Internal Server Error: model failed to load, this may be due to resource limitations or an internal error, check ollama server logs for details
This turned out not to be a RAM/resource issue. The server log shows the runner crashing during Metal library initialization.

Environment
Ollama version: 0.20.5
OS: macOS
Chip / GPU: Apple M5
RAM: 32 GB
Available memory at load time: ~16 GB free
Install method: reinstalled Ollama app, also deleted ~/.ollama
Relevant log excerpt shows:

text

Collapse
Save
Copy
1
2
3
4
GPU name: Apple M5
GPU family: MTLGPUFamilyApple10
GPU family: MTLGPUFamilyCommon3
GPU family: MTLGPUFamilyMetal4
Steps to reproduce
Start Ollama normally on macOS Apple M5
Pull and run any model, for example:
bash

Collapse
Save
Copy
1
ollama run nemotron-3-nano:4b
or even a smaller one.

Model downloads successfully
Load fails with:
bash

Collapse
Save
Copy
1
Error: 500 Internal Server Error: model failed to load, this may be due to resource limitations or an internal error, check ollama server logs for details
What I already tried
Rebooted the Mac
Reinstalled Ollama
Deleted entire ~/.ollama
Pulled a fresh model again
Confirmed RAM is available
Problem affects all models, not just one specific model
So this does not appear to be corrupted model files or simple memory pressure.

Relevant logs
The important part seems to be a Metal shader/library compilation failure, followed by runner abort:

text

Collapse
Save
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ggml_metal_library_init: error: Error Domain=MTLLibraryErrorDomain Code=3
...
static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<bfloat, half>'
"Input types must match cooperative tensor types"
...
static_assert failed due to requirement '__tensor_ops_detail::__is_same_v<half, bfloat>'
"Input types must match cooperative tensor types"
...
ggml_metal_init: error: failed to initialize the Metal library
ggml_backend_metal_device_init: error: failed to allocate context
ggml-backend.cpp:258: GGML_ASSERT(backend) failed
SIGABRT: abort
...
time=2026-04-10T21:27:35.557+02:00 level=ERROR source=server.go:316 msg="llama runner terminated" error="exit status 2"
time=2026-04-10T21:27:35.557+02:00 level=ERROR source=server.go:1219 msg="do load request" error="Post "http://127.0.0.1:50255/load\": EOF"
time=2026-04-10T21:27:35.557+02:00 level=INFO source=sched.go:511 msg="Load failed" model=/Users/david/.ollama/models/blobs/sha256-... error="model failed to load, this may be due to resource limitations or an internal error, check ollama server logs for details"
There are also repeated lines like:

text

Collapse
Save
Copy
1
2
ggml_metal_init: the device does not have a precompiled Metal library - this is unexpected
ggml_metal_init: will try to compile it on the fly
and then compilation fails.

Why I think this is a Metal / Apple M5 compatibility bug
This does not look like a generic OOM/resource problem because:

plenty of RAM is free
reinstall + deleting ~/.ollama does not help
all models fail the same way
the crash happens specifically during ggml_metal_library_init
the log points to type mismatch in Metal tensor ops (bfloat vs half)
this machine uses a very new GPU family: Apple M5 / MTLGPUFamilyApple10
So it looks like Ollama / ggml Metal backend may currently be incompatible with this Apple GPU / Metal toolchain combination.

Expected behavior
Models should load normally, or Ollama should gracefully fall back instead of crashing the runner.

Actual behavior
Any model load request fails with HTTP 500 because the runner crashes during Metal backend initialization.

主要言語
Python
スター
10.6k
フォーク
1.2k
平均マージ
1時間 45分
マージ済み PR(30日)
2

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ollama/ollama-python のほかの issue

ollama/ollama-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。