What this thread does
Do first: Upgrade Ollama to v0.33.0 (released 2026-08-21).
Symptom
failed to restore cache, freeing all caches appears in the Ollama server log when an agent request loses reusable prefix state. Reporter electroheadfx used Ollama 0.32.13 on macOS and described repeated long prefills. Other affected users in #17839 include sladomic, ghmer, ahmadasmaredi and lueghausen; their reports cover agent hangs and long prefill timeouts, not necessarily the identical log line.
Cause
Maintainer jessegross and merged PR #17901 describe two MLX cache faults: cancellation discarded prefill progress, and resumed prefills could create snapshots that did not span the history they claimed. A timeout could therefore make retries start over, repeatedly reaching the same timeout. Recurrent-layer models could lose all cache state when restoring an inconsistent snapshot.
Fix
1. Upgrade to Ollama v0.33.0; the release describes retaining restore points after cancellation and correcting resumed snapshots. 2. If you cannot upgrade, lueghausen reports raising the client's idle timeout and splitting tasks into smaller prompts in #17839. The source supplies no universal setting name or numeric timeout for this workaround.
Fixed in
v0.33.0 (released 2026-08-21). PR #17901 by jessegross merged 2026-08-21. Its cache changes preserve completed restore points so a retry can resume rather than discard the prefill.
If it still fails
- The patch preserves progress; it does not eliminate the initial cold prefill of a large prompt.
- electroheadfx later reports continued trouble after an update, while lueghausen reports recovery on
0.33.1. The issue does not establish that every agent hang has the same cache cause. - The merged PR addresses the MLX engine; it does not claim a fix for all backends.
Not for: Vulkan second-request slowdown; see ollama-vulkan-second-request-cache-slowdown.
Sources
- Agent integrations hang indefinitely with local Qwen models on macOS, electroheadfx, opened 2026-08-18; closed as completed on 2026-08-21: "failed to restore cache, freeing all caches". Read the reporter, jessegross, sladomic, ghmer, ahmadasmaredi and lueghausen comments.
- mlxrunner: make prefix cache restore points survive cancelled and resumed prefills, jessegross; merged 2026-08-21.
- v0.33.0, published 2026-08-21.
- v0.33.1, published 2026-08-26.
- v0.32.15...v0.33.0, release comparison containing the cache changes.
Checked
2026-11-24; read issue #17839 and comments, PR #17901, releases v0.33.0 and v0.33.1, and v0.32.15...v0.33.0 comparison API records; no command was run.
Started from a post by @electroheadfx, packaged by the editor. Original post