ollama - ✅(Solved) Fix 0.20.5: Metal shader compilation fails on M5 Max (MTLGPUFamilyMetal4) — MPPTensorOpsMatMul2d type mismatch [1 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#15487Fetched 2026-04-11 06:12:26
View on GitHub
Comments
2
Participants
3
Timeline
2
Reactions
1
Timeline (top)
commented ×2

Error Message

the GPU family: MTLGPUFamilyApple10 (1010) block, the MPPTensorOpsMatMul2dImpl.h:3266:5: error: static_assert failed block, and the Ollama version.

PR fix notes

PR #27: feat: LangChain integration & AI autocomplete (#9)

Description (problem / solution / changelog)

Summary

Implements issue #9 — LangChain.js provider-factory abstraction, SSE-streaming autocomplete endpoint, and CodeMirror 6 ghost text overlay.

Closes #9

What's in this PR

  • Server
    • Provider factory (ollama default gemma4, openai, vertex) driven by LLM_PROVIDER/LLM_MODEL env vars
    • Autocomplete chain with few-shot prompt template + StringOutputParser
    • AiRateLimiter class — 1 in-flight request per user, 60s timeout, injectable now() for deterministic tests
    • langchainPlugin Fastify plugin exposing app.aiProvider, app.aiRateLimit, app.aiGate decorators; onResponse/onError release hooks
    • POST /api/ai/complete SSE streaming route with exported createAbortHandlers helper
  • Client
    • CodeMirror 6 ghost-text extension (StateField + WidgetType)
    • parseSseStream async-iterable SSE parser
    • useAiComplete composable: 300ms debounce + AbortController cancellation
    • AiSuggestion.vue wires composable to the editor's EditorView
    • CodeEditor.vue exposes its EditorView ref and includes ghostTextExtension
    • PostEditor.vue mounts <AiSuggestion> and triggers requestCompletion on content/language changes
  • Tests: 1761 passing / 1 skipped; 100% coverage (lines/branches/functions/statements)
  • Bruno: bruno/ai/complete.bru with SSE assertions
  • Knowledge base: 8 learnings captured in .beads/knowledge/ (patterns + gotchas)

Key design decision — preHandler instead of onRequest

The issue's example puts the rate limiter in a Fastify onRequest hook, but onRequest fires before app.authenticate (which runs in preHandler), so request.user would be undefined there. This PR composes app.aiGate = [app.authenticate, app.aiRateLimit] as a preHandler, matching the existing pattern at packages/server/src/routes/posts.ts:35. The adversarial reviewers accepted this deviation as a necessary correctness fix.

Verification

GateStatus
Unit tests (1761 pass, 1 skip)
Coverage 100% lines/branches/functions/statements per .coverage-thresholds.json
Typecheck + ESLint
Bruno ai/complete.bru against live server (OpenAI provider gpt-5.4) — 9 token events + done event + suggestion return a + b;
Bruno ai/ collection tests (2/2 assertions pass)
Error-event path verified against a real Ollama failure on Apple M5 Metal4
Plan Review Gate (Feasibility / Completeness / Scope)✅ 3/3 PASS after 3 iterations
Per-WU adversarial reviews✅ all 13 code-WUs PASS
Manual browser E2E (type → ghost text → Tab accepts)⚠️ pending local verification by maintainer

Notes for reviewers

  • gemma4 stays as the declared default in .env.example per the issue spec. Live verification on this PR used OpenAI provider because the Apple M5 + macOS Tahoe + ollama 0.20.5/0.20.6 stack has a Metal4 shader compile bug (upstream ollama#15487, fix merged as commit ec29ce4, awaiting a release). Once that release ships, swapping LLM_PROVIDER=openaiLLM_PROVIDER=ollama in local .env is enough to verify the happy path with gemma4.
  • Plan at docs/superpowers/plans/2026-04-13-langchain-ai-autocomplete.md (uncommitted — a previously-established convention for this repo).
  • The Bruno full -r regression has pre-existing failures unrelated to this branch (500s on bookmarks/comments/revisions, and ai/complete gets 401 because auth/logout.bru runs before it alphabetically). None of those endpoints were touched.

Test plan

  • npm test — 1761/1762
  • npm run test:coverage — 100% all metrics
  • npm run typecheck — clean
  • npx eslint — clean (2 pre-existing warnings on untouched lines)
  • Live server + Bruno bruno/ai/complete.bru — PASS
  • Reviewer: open the editor in a browser, type function add(a, b) {, wait 300ms, verify translucent ghost text, press Tab to accept, press any other key to dismiss

🤖 Generated with Claude Code

Changed files

  • .beads/knowledge/codebase-facts.jsonl (modified, +1/-0)
  • .beads/knowledge/decisions.jsonl (modified, +3/-0)
  • .beads/knowledge/gotchas.jsonl (modified, +15/-0)
  • .beads/knowledge/patterns.jsonl (modified, +5/-0)
  • .gitignore (modified, +3/-0)
  • CLAUDE.md (modified, +33/-0)
  • bruno/ai/complete.bru (added, +53/-0)
  • bruno/bookmarks/list-bookmarks.bru (added, +23/-0)
  • bruno/bookmarks/toggle-bookmark.bru (added, +21/-0)
  • bruno/comments/create-comment.bru (added, +40/-0)
  • bruno/comments/create-inline-comment.bru (added, +31/-0)
  • bruno/comments/create-reply.bru (added, +30/-0)
  • bruno/comments/delete-comment.bru (added, +25/-0)
  • bruno/comments/edit-comment.bru (added, +30/-0)
  • bruno/comments/list-comments-by-revision.bru (added, +19/-0)
  • bruno/comments/list-comments.bru (added, +22/-0)
  • bruno/environments/local.bru (modified, +1/-0)
  • bruno/posts/create-post.bru (modified, +3/-0)
  • bruno/posts/get-feed.bru (modified, +5/-1)
  • bruno/search/basic-query.bru (added, +34/-0)
  • bruno/search/empty-query.bru (added, +28/-0)
  • bruno/search/filter-by-tag.bru (added, +27/-0)
  • bruno/search/filter-by-type.bru (added, +27/-0)
  • bruno/search/fuzzy-search.bru (added, +28/-0)
  • bruno/search/people-match.bru (added, +28/-0)
  • bruno/tags/list-tags.bru (added, +27/-0)
  • bruno/tags/popular-tags.bru (added, +26/-0)
  • bruno/tags/subscribe.bru (added, +21/-0)
  • bruno/tags/subscriptions.bru (added, +20/-0)
  • bruno/tags/unsubscribe.bru (added, +20/-0)
  • bruno/votes/downvote.bru (added, +26/-0)
  • bruno/votes/remove-vote.bru (added, +21/-0)
  • bruno/votes/upvote.bru (added, +32/-0)
  • docs/superpowers/plans/2026-04-13-search-postgres-fts-cmdk.md (added, +878/-0)
  • package-lock.json (modified, +2982/-217)
  • package.json (modified, +2/-0)
  • packages/client/package.json (modified, +2/-0)
  • packages/client/src/__tests__/components/editor/AiSuggestion.test.ts (added, +156/-0)
  • packages/client/src/__tests__/components/editor/CodeEditor.test.ts (modified, +42/-7)
  • packages/client/src/__tests__/components/editor/EditorToolbar.test.ts (modified, +301/-2)
  • packages/client/src/__tests__/components/editor/PostEditor.test.ts (modified, +65/-1)
  • packages/client/src/__tests__/components/post/CodeViewer.test.ts (modified, +55/-0)
  • packages/client/src/__tests__/components/post/CommentInput.test.ts (added, +70/-0)
  • packages/client/src/__tests__/components/post/CommentSection.test.ts (added, +199/-0)
  • packages/client/src/__tests__/components/post/CommentThread.test.ts (added, +287/-0)
  • packages/client/src/__tests__/components/post/InlineComment.test.ts (added, +54/-0)
  • packages/client/src/__tests__/components/post/PostActions.test.ts (added, +222/-0)
  • packages/client/src/__tests__/components/post/PostDetail.test.ts (modified, +242/-6)
  • packages/client/src/__tests__/components/post/PostListItem.test.ts (modified, +27/-0)
  • packages/client/src/__tests__/components/post/PresenceIndicator.test.ts (added, +224/-0)
  • packages/client/src/__tests__/components/search/SearchResultGroup.test.ts (added, +180/-0)
  • packages/client/src/__tests__/components/search/SearchResultItem.test.ts (added, +226/-0)
  • packages/client/src/__tests__/components/shell/TheSearchModal.test.ts (added, +787/-0)
  • packages/client/src/__tests__/components/shell/TheSidebar.test.ts (modified, +147/-4)
  • packages/client/src/__tests__/components/shell/TheTopBar.test.ts (added, +159/-0)
  • packages/client/src/__tests__/composables/useAiComplete.test.ts (added, +178/-0)
  • packages/client/src/__tests__/composables/useBookmarks.test.ts (added, +135/-0)
  • packages/client/src/__tests__/composables/useComments.test.ts (added, +544/-0)
  • packages/client/src/__tests__/composables/useFeed.test.ts (modified, +97/-0)
  • packages/client/src/__tests__/composables/useKeyboard.test.ts (added, +321/-0)
  • packages/client/src/__tests__/composables/usePresence.test.ts (added, +387/-0)
  • packages/client/src/__tests__/composables/useSearch.test.ts (added, +271/-0)
  • packages/client/src/__tests__/composables/useTags.test.ts (added, +342/-0)
  • packages/client/src/__tests__/composables/useVotes.test.ts (added, +309/-0)
  • packages/client/src/__tests__/composables/useWebSocket.test.ts (added, +985/-0)
  • packages/client/src/__tests__/layouts/AppLayout.test.ts (added, +282/-0)
  • packages/client/src/__tests__/lib/ai/ghost-text.test.ts (added, +80/-0)
  • packages/client/src/__tests__/lib/ai/sse-stream.test.ts (added, +63/-0)
  • packages/client/src/__tests__/lib/api.test.ts (modified, +102/-0)
  • packages/client/src/__tests__/lib/debounce.test.ts (added, +97/-0)
  • packages/client/src/__tests__/pages/HomePage.test.ts (modified, +7/-1)
  • packages/client/src/__tests__/pages/PostViewPage.test.ts (modified, +88/-0)
  • packages/client/src/__tests__/pages/SearchPage.test.ts (added, +577/-0)
  • packages/client/src/__tests__/plugins/router.test.ts (modified, +25/-0)
  • packages/client/src/__tests__/stores/comments.test.ts (added, +389/-0)
  • packages/client/src/__tests__/stores/feed.test.ts (modified, +104/-0)
  • packages/client/src/__tests__/stores/realtime.test.ts (added, +132/-0)
  • packages/client/src/__tests__/stores/search.test.ts (added, +257/-0)
  • packages/client/src/__tests__/stores/tags.test.ts (added, +75/-0)
  • packages/client/src/components/editor/AiSuggestion.vue (added, +41/-0)
  • packages/client/src/components/editor/CodeEditor.vue (modified, +15/-2)
  • packages/client/src/components/editor/EditorToolbar.vue (modified, +73/-11)
  • packages/client/src/components/editor/PostEditor.vue (modified, +23/-2)
  • packages/client/src/components/post/CodeViewer.vue (modified, +21/-2)
  • packages/client/src/components/post/CommentInput.vue (added, +52/-0)
  • packages/client/src/components/post/CommentSection.vue (added, +57/-0)
  • packages/client/src/components/post/CommentThread.vue (added, +119/-0)
  • packages/client/src/components/post/InlineComment.vue (added, +19/-0)
  • packages/client/src/components/post/PostActions.vue (modified, +80/-7)
  • packages/client/src/components/post/PostDetail.vue (modified, +73/-5)
  • packages/client/src/components/post/PresenceIndicator.vue (added, +55/-0)
  • packages/client/src/components/search/SearchResultGroup.vue (added, +32/-0)
  • packages/client/src/components/search/SearchResultItem.vue (added, +93/-0)
  • packages/client/src/components/shell/TheSearchModal.vue (added, +297/-0)
  • packages/client/src/components/shell/TheSidebar.vue (modified, +34/-9)
  • packages/client/src/components/shell/TheTopBar.vue (modified, +17/-6)
  • packages/client/src/composables/useAiComplete.ts (added, +95/-0)
  • packages/client/src/composables/useBookmarks.ts (added, +47/-0)
  • packages/client/src/composables/useComments.ts (added, +139/-0)
  • packages/client/src/composables/useFeed.ts (modified, +39/-1)
RAW_BUFFERClick to expand / collapse

the GPU family: MTLGPUFamilyApple10 (1010) block, the MPPTensorOpsMatMul2dImpl.h:3266:5: error: static_assert failed block, and the Ollama version. NOTE: it works on 0.18.3 on the same hardware

extent analysis

TL;DR

Downgrade to version 0.18.3 as it is known to work on the same hardware.

Guidance

  • The error is likely caused by a compatibility issue between the current version and the GPU family: MTLGPUFamilyApple10 (1010).
  • Verify that downgrading to version 0.18.3 resolves the issue by testing the same functionality on the same hardware.
  • If downgrading is not feasible, consider checking for any updates or patches related to the MPPTensorOpsMatMul2dImpl.h file and the Ollama version.
  • Investigate potential configuration changes that may be required to support the current version on the specific GPU family.

Notes

The solution is based on the fact that version 0.18.3 is known to work on the same hardware, but it may not be the most up-to-date or optimal solution.

Recommendation

Apply workaround: Downgrade to version 0.18.3, as it is a known working configuration for the specific hardware.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

ollama - ✅(Solved) Fix 0.20.5: Metal shader compilation fails on M5 Max (MTLGPUFamilyMetal4) — MPPTensorOpsMatMul2d type mismatch [1 pull requests, 2 comments, 3 participants]