[GH-ISSUE #170] How to fix Error: stream: digest mismatch #46577

Closed
opened 2026-04-27 23:04:53 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @dtgriscom on GitHub (Jul 22, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/170

Originally assigned to: @BruceMacD on GitHub.

I was downloading llama2:13b, and for some reason the download went wrong. Now, when I try to run it, I get an error:

MacBook-Pro-2:~ griscom$ ollama run llama2:13b
pulling manifest
pulling f79142715bc9... 100% |█████████████████████████████████████████████████| (7.3/7.3 GB, 3.5 TB/s)        
pulling 2cc93ea1ade8... 100% |████████████████████████████████████████████████████| (90/90 B, 478 kB/s)        
pulling a73730bc2562... 100% |██████████████████████████████████████████████████| (509/509 B, 7.6 MB/s)        
pulling 13af22070723... 100% |██████████████████████████████████████████████████| (4.4/4.4 kB, 66 MB/s)        
pulling 6e004b4cefda... 100% |██████████████████████████████████████████████████| (373/373 B, 1.1 MB/s)        
verifying sha256 digest
Error: stream: digest mismatch: want sha256:f79142715bc9539a2edbb4b253548db8b34fac22736593eeaa28555874476e30, got sha256:88c8d47ae981fac63e71d20e9a74324252bcd52a11cc999c09bf38ee8106c723
MacBook-Pro-2:~ griscom$ 

I expect I need to remove the model and download again, but that doesn't work:

MacBook-Pro-2:~ griscom$ ollama rm llama2:13b
Error: unmarshal: invalid character '{' after top-level value
MacBook-Pro-2:~ griscom$

How can I fix this? (I presume by deleting bits and pieces from ~/.ollama...

Originally created by @dtgriscom on GitHub (Jul 22, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/170 Originally assigned to: @BruceMacD on GitHub. I was downloading `llama2:13b`, and for some reason the download went wrong. Now, when I try to run it, I get an error: ``` MacBook-Pro-2:~ griscom$ ollama run llama2:13b pulling manifest pulling f79142715bc9... 100% |█████████████████████████████████████████████████| (7.3/7.3 GB, 3.5 TB/s) pulling 2cc93ea1ade8... 100% |████████████████████████████████████████████████████| (90/90 B, 478 kB/s) pulling a73730bc2562... 100% |██████████████████████████████████████████████████| (509/509 B, 7.6 MB/s) pulling 13af22070723... 100% |██████████████████████████████████████████████████| (4.4/4.4 kB, 66 MB/s) pulling 6e004b4cefda... 100% |██████████████████████████████████████████████████| (373/373 B, 1.1 MB/s) verifying sha256 digest Error: stream: digest mismatch: want sha256:f79142715bc9539a2edbb4b253548db8b34fac22736593eeaa28555874476e30, got sha256:88c8d47ae981fac63e71d20e9a74324252bcd52a11cc999c09bf38ee8106c723 MacBook-Pro-2:~ griscom$ ``` I expect I need to remove the model and download again, but that doesn't work: ``` MacBook-Pro-2:~ griscom$ ollama rm llama2:13b Error: unmarshal: invalid character '{' after top-level value MacBook-Pro-2:~ griscom$ ``` How can I fix this? (I presume by deleting bits and pieces from `~/.ollama`...
GiteaMirror added the bug label 2026-04-27 23:04:53 -05:00
Author
Owner

@pdevine commented on GitHub (Jul 22, 2023):

@dtgriscom you can rm ~/.ollama/models/blobs/sha256:f79142715bc9539a2edbb4b253548db8b34fac22736593eeaa28555874476e30 and then ollama pull llama2:13b again.

Did you happen to suspend your machine while you were pulling? I'll take a look for the invalid char bug. I think that's unrelated.

<!-- gh-comment-id:1646397485 --> @pdevine commented on GitHub (Jul 22, 2023): @dtgriscom you can `rm ~/.ollama/models/blobs/sha256:f79142715bc9539a2edbb4b253548db8b34fac22736593eeaa28555874476e30` and then `ollama pull llama2:13b` again. Did you happen to suspend your machine while you were pulling? I'll take a look for the invalid char bug. I think that's unrelated.
Author
Owner

@dtgriscom commented on GitHub (Jul 22, 2023):

The rm worked. And, good guess on my suspending my machine.

<!-- gh-comment-id:1646407807 --> @dtgriscom commented on GitHub (Jul 22, 2023): The `rm` worked. And, good guess on my suspending my machine.
Author
Owner

@pdevine commented on GitHub (Jul 22, 2023):

When you suspended the machine, did the file transfer fail and then you restarted it, or did it just wake up and keep going without exiting?

The stream uses an 8k buffer, and I think what's happening is it's writing part of the buffer and then getting suspended. When it restarts it looks at the current size of the written file and then starts appending to it, but the last characters are probably garbage. If I divide the file up into 8k chunks and throw out the last chunk and resume from there, I think I can make it work after a resume.

<!-- gh-comment-id:1646443999 --> @pdevine commented on GitHub (Jul 22, 2023): When you suspended the machine, did the file transfer fail and then you restarted it, or did it just wake up and keep going without exiting? The stream uses an 8k buffer, and I think what's happening is it's writing _part_ of the buffer and then getting suspended. When it restarts it looks at the current size of the written file and then starts appending to it, but the last characters are probably garbage. If I divide the file up into 8k chunks and throw out the last chunk and resume from there, I _think_ I can make it work after a resume.
Author
Owner

@pdevine commented on GitHub (Jul 22, 2023):

I checked in #173 which should fix the error w/ the spurious 'invalid character' error.

<!-- gh-comment-id:1646501315 --> @pdevine commented on GitHub (Jul 22, 2023): I checked in #173 which should fix the error w/ the spurious 'invalid character' error.
Author
Owner

@dtgriscom commented on GitHub (Jul 22, 2023):

When you suspended the machine, did the file transfer fail and then you restarted it, or did it just wake up and keep going without exiting?

It kept going when I woke my machine up. That said, I just closed my laptop overnight with a transfer in progress (can't teach me, eh?) and when I woke the machine the transfer stopped with Error: stream: unexpected EOF. Restarting seemed to resume the download, but rather than download another possibly faulty 6GB I'll start afresh.

<!-- gh-comment-id:1646564940 --> @dtgriscom commented on GitHub (Jul 22, 2023): > When you suspended the machine, did the file transfer fail and then you restarted it, or did it just wake up and keep going without exiting? It kept going when I woke my machine up. That said, I just closed my laptop overnight with a transfer in progress (can't teach me, eh?) and when I woke the machine the transfer stopped with `Error: stream: unexpected EOF`. Restarting seemed to resume the download, but rather than download another possibly faulty 6GB I'll start afresh.
Author
Owner

@BruceMacD commented on GitHub (Jul 24, 2023):

this should be resolved now with some tweaks to resume, if someone else sees this please let me know

<!-- gh-comment-id:1648597576 --> @BruceMacD commented on GitHub (Jul 24, 2023): this should be resolved now with some tweaks to resume, if someone else sees this please let me know
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#46577