ollama - 💡(How to fix) Fix Windows: crash on startup - Exception 0xc0000005 in x/imagegen/mlx init() [1 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#15481Fetched 2026-04-11 06:12:32
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
labeled ×1

Error Message

Exception 0xc0000005 0x8 0x7ffb9306cb12 0x7ffb9306cb12 PC=0x7ffb9306cb12 signal arrived during external code execution

runtime.cgocall(0x7ff6fbb24910, 0xc000049da0) runtime/cgocall.go:167 +0x3e fp=0xc000049d78 sp=0xc000049d10 pc=0x7ff6fa9f243e github.com/ollama/ollama/x/imagegen/mlx._Cfunc_mlx_random_key(0xc000226118, 0x19d77bef963) _cgo_gotypes.go:1978 +0x50 fp=0xc000049da0 sp=0xc000049d78 pc=0x7ff6fb081770 github.com/ollama/ollama/x/imagegen/mlx.RandomKey.func1(...) github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1870 github.com/ollama/ollama/x/imagegen/mlx.RandomKey(0x19d77bef963) github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1870 +0x5d fp=0xc000049dd8 sp=0xc000049da0 pc=0x7ff6fb08a69d github.com/ollama/ollama/x/imagegen/mlx.init.0() github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1848 +0xa9 fp=0xc000049e28 sp=0xc000049dd8 pc=0x7ff6fb08a4a9 runtime.doInit1(0x7ff6fceb62c0) runtime/proc.go:7350 +0xdd fp=0xc000049f50 sp=0xc000049e28 pc=0x7ff6fa9d343d runtime.doInit(...) runtime/proc.go:7317 runtime.main() runtime/proc.go:254 +0x325 fp=0xc000049fe0 sp=0xc000049f50 pc=0x7ff6fa9c4e85 runtime.goexit({}) runtime/asm_amd64.s:1700 +0x1 fp=0xc000049fe8 sp=0xc000049fe0 pc=0x7ff6fa9fdb21

goroutine 2 gp=0xc0000028c0 m=nil [force gc (idle)]: runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?) runtime/proc.go:435 +0xce fp=0xc00008bfa8 sp=0xc00008bf88 pc=0x7ff6fa9f598e runtime.goparkunlock(...) runtime/proc.go:441 runtime.forcegchelper() runtime/proc.go:348 +0xb8 fp=0xc00008bfe0 sp=0xc00008bfa8 pc=0x7ff6fa9c50f8 runtime.goexit({}) runtime/asm_amd64.s:1700 +0x1 fp=0xc00008bfe8 sp=0xc00008bfe0 pc=0x7ff6fa9fdb21 created by runtime.init.7 in goroutine 1 runtime/proc.go:336 +0x1a

goroutine 3 gp=0xc000002c40 m=nil [GC sweep wait]: runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?) runtime/proc.go:435 +0xce fp=0xc00008df80 sp=0xc00008df60 pc=0x7ff6fa9f598e runtime.goparkunlock(...) runtime/proc.go:441 runtime.bgsweep(0xc00009a000) runtime/mgcsweep.go:276 +0x94 fp=0xc00008dfc8 sp=0xc00008df80 pc=0x7ff6fa9ade74 runtime.gcenable.gowrap1() runtime/mgc.go:204 +0x25 fp=0xc00008dfe0 sp=0xc00008dfc8 pc=0x7ff6fa9a2285 runtime.goexit({}) runtime/asm_amd64.s:1700 +0x1 fp=0xc00008dfe8 sp=0xc00008dfe0 pc=0x7ff6fa9fdb21 created by runtime.gcenable in goroutine 1 runtime/mgc.go:204 +0x66

goroutine 4 gp=0xc000002e00 m=nil [GC scavenge wait]: runtime.gopark(0xc00009a000?, 0x7ff6fc3ffc10?, 0x1?, 0x0?, 0xc000002e00?) runtime/proc.go:435 +0xce fp=0xc0000a1f78 sp=0xc0000a1f58 pc=0x7ff6fa9f598e runtime.goparkunlock(...) runtime/proc.go:441 runtime.(*scavengerState).park(0x7ff6fcfd0d80) runtime/mgcscavenge.go:425 +0x49 fp=0xc0000a1fa8 sp=0xc0000a1f78 pc=0x7ff6fa9ab909 runtime.bgscavenge(0xc00009a000) runtime/mgcscavenge.go:653 +0x3c fp=0xc0000a1fc8 sp=0xc0000a1fa8 pc=0x7ff6fa9abe7c runtime.gcenable.gowrap2() runtime/mgc.go:205 +0x25 fp=0xc0000a1fe0 sp=0xc0000a1fc8 pc=0x7ff6fa9a2225 runtime.goexit({}) runtime/asm_amd64.s:1700 +0x1 fp=0xc0000a1fe8 sp=0xc0000a1fe0 pc=0x7ff6fa9fdb21 created by runtime.gcenable in goroutine 1 runtime/mgc.go:205 +0xa5

goroutine 18 gp=0xc0001081c0 m=nil [finalizer wait]: runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?) runtime/proc.go:435 +0xce fp=0xc00009de30 sp=0xc00009de10 pc=0x7ff6fa9f598e runtime.runfinq() runtime/mfinal.go:196 +0x107 fp=0xc00009dfe0 sp=0xc00009de30 pc=0x7ff6fa9a1207 runtime.goexit({}) runtime/asm_amd64.s:1700 +0x1 fp=0xc00009dfe8 sp=0xc00009dfe0 pc=0x7ff6fa9fdb21 created by runtime.createfing in goroutine 1 runtime/mfinal.go:166 +0x3d rax 0x64 rbx 0x7ffb9313098c rcx 0xc687c65efb030000 rdx 0x1c961f50000 rdi 0x1c9e17c0860 rsi 0x0 rbp 0x6f412ff409 rsp 0x6f412feea0 r8 0x7ffffffffffffffc r9 0x6f410b1000 r10 0x8101010101010100 r11 0x1c96213ad80 r12 0xffffffffffffffff r13 0x24 r14 0x1c9620ef318 r15 0x0 rip 0x7ffb9306cb12 rflags 0x10202 cs 0x33 fs 0x53 gs 0x2b

Code Example

Exception 0xc0000005 0x8 0x7ffb9306cb12 0x7ffb9306cb12
PC=0x7ffb9306cb12
signal arrived during external code execution

runtime.cgocall(0x7ff6fbb24910, 0xc000049da0)
        runtime/cgocall.go:167 +0x3e fp=0xc000049d78 sp=0xc000049d10 pc=0x7ff6fa9f243e
github.com/ollama/ollama/x/imagegen/mlx._Cfunc_mlx_random_key(0xc000226118, 0x19d77bef963)
        _cgo_gotypes.go:1978 +0x50 fp=0xc000049da0 sp=0xc000049d78 pc=0x7ff6fb081770
github.com/ollama/ollama/x/imagegen/mlx.RandomKey.func1(...)
        github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1870
github.com/ollama/ollama/x/imagegen/mlx.RandomKey(0x19d77bef963)
        github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1870 +0x5d fp=0xc000049dd8 sp=0xc000049da0 pc=0x7ff6fb08a69d
github.com/ollama/ollama/x/imagegen/mlx.init.0()
        github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1848 +0xa9 fp=0xc000049e28 sp=0xc000049dd8 pc=0x7ff6fb08a4a9
runtime.doInit1(0x7ff6fceb62c0)
        runtime/proc.go:7350 +0xdd fp=0xc000049f50 sp=0xc000049e28 pc=0x7ff6fa9d343d
runtime.doInit(...)
        runtime/proc.go:7317
runtime.main()
        runtime/proc.go:254 +0x325 fp=0xc000049fe0 sp=0xc000049f50 pc=0x7ff6fa9c4e85
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc000049fe8 sp=0xc000049fe0 pc=0x7ff6fa9fdb21

goroutine 2 gp=0xc0000028c0 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        runtime/proc.go:435 +0xce fp=0xc00008bfa8 sp=0xc00008bf88 pc=0x7ff6fa9f598e
runtime.goparkunlock(...)
        runtime/proc.go:441
runtime.forcegchelper()
        runtime/proc.go:348 +0xb8 fp=0xc00008bfe0 sp=0xc00008bfa8 pc=0x7ff6fa9c50f8
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc00008bfe8 sp=0xc00008bfe0 pc=0x7ff6fa9fdb21
created by runtime.init.7 in goroutine 1
        runtime/proc.go:336 +0x1a

goroutine 3 gp=0xc000002c40 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        runtime/proc.go:435 +0xce fp=0xc00008df80 sp=0xc00008df60 pc=0x7ff6fa9f598e
runtime.goparkunlock(...)
        runtime/proc.go:441
runtime.bgsweep(0xc00009a000)
        runtime/mgcsweep.go:276 +0x94 fp=0xc00008dfc8 sp=0xc00008df80 pc=0x7ff6fa9ade74
runtime.gcenable.gowrap1()
        runtime/mgc.go:204 +0x25 fp=0xc00008dfe0 sp=0xc00008dfc8 pc=0x7ff6fa9a2285
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc00008dfe8 sp=0xc00008dfe0 pc=0x7ff6fa9fdb21
created by runtime.gcenable in goroutine 1
        runtime/mgc.go:204 +0x66

goroutine 4 gp=0xc000002e00 m=nil [GC scavenge wait]:
runtime.gopark(0xc00009a000?, 0x7ff6fc3ffc10?, 0x1?, 0x0?, 0xc000002e00?)
        runtime/proc.go:435 +0xce fp=0xc0000a1f78 sp=0xc0000a1f58 pc=0x7ff6fa9f598e
runtime.goparkunlock(...)
        runtime/proc.go:441
runtime.(*scavengerState).park(0x7ff6fcfd0d80)
        runtime/mgcscavenge.go:425 +0x49 fp=0xc0000a1fa8 sp=0xc0000a1f78 pc=0x7ff6fa9ab909
runtime.bgscavenge(0xc00009a000)
        runtime/mgcscavenge.go:653 +0x3c fp=0xc0000a1fc8 sp=0xc0000a1fa8 pc=0x7ff6fa9abe7c
runtime.gcenable.gowrap2()
        runtime/mgc.go:205 +0x25 fp=0xc0000a1fe0 sp=0xc0000a1fc8 pc=0x7ff6fa9a2225
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc0000a1fe8 sp=0xc0000a1fe0 pc=0x7ff6fa9fdb21
created by runtime.gcenable in goroutine 1
        runtime/mgc.go:205 +0xa5

goroutine 18 gp=0xc0001081c0 m=nil [finalizer wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        runtime/proc.go:435 +0xce fp=0xc00009de30 sp=0xc00009de10 pc=0x7ff6fa9f598e
runtime.runfinq()
        runtime/mfinal.go:196 +0x107 fp=0xc00009dfe0 sp=0xc00009de30 pc=0x7ff6fa9a1207
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc00009dfe8 sp=0xc00009dfe0 pc=0x7ff6fa9fdb21
created by runtime.createfing in goroutine 1
        runtime/mfinal.go:166 +0x3d
rax     0x64
rbx     0x7ffb9313098c
rcx     0xc687c65efb030000
rdx     0x1c961f50000
rdi     0x1c9e17c0860
rsi     0x0
rbp     0x6f412ff409
rsp     0x6f412feea0
r8      0x7ffffffffffffffc
r9      0x6f410b1000
r10     0x8101010101010100
r11     0x1c96213ad80
r12     0xffffffffffffffff
r13     0x24
r14     0x1c9620ef318
r15     0x0
rip     0x7ffb9306cb12
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b
RAW_BUFFERClick to expand / collapse

What is the issue?

Ollama crashes immediately on startup with an access violation (0xc0000005). The crash occurs during package initialization in the MLX imagegen module, which appears to be Apple-specific code bundled into the Windows build. What happened: Running ollama in PowerShell causes an immediate crash with a Go runtime panic before any commands can execute.

What I expected: Ollama should start normally on Windows.

Relevant log output

Exception 0xc0000005 0x8 0x7ffb9306cb12 0x7ffb9306cb12
PC=0x7ffb9306cb12
signal arrived during external code execution

runtime.cgocall(0x7ff6fbb24910, 0xc000049da0)
        runtime/cgocall.go:167 +0x3e fp=0xc000049d78 sp=0xc000049d10 pc=0x7ff6fa9f243e
github.com/ollama/ollama/x/imagegen/mlx._Cfunc_mlx_random_key(0xc000226118, 0x19d77bef963)
        _cgo_gotypes.go:1978 +0x50 fp=0xc000049da0 sp=0xc000049d78 pc=0x7ff6fb081770
github.com/ollama/ollama/x/imagegen/mlx.RandomKey.func1(...)
        github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1870
github.com/ollama/ollama/x/imagegen/mlx.RandomKey(0x19d77bef963)
        github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1870 +0x5d fp=0xc000049dd8 sp=0xc000049da0 pc=0x7ff6fb08a69d
github.com/ollama/ollama/x/imagegen/mlx.init.0()
        github.com/ollama/ollama/x/imagegen/mlx/mlx.go:1848 +0xa9 fp=0xc000049e28 sp=0xc000049dd8 pc=0x7ff6fb08a4a9
runtime.doInit1(0x7ff6fceb62c0)
        runtime/proc.go:7350 +0xdd fp=0xc000049f50 sp=0xc000049e28 pc=0x7ff6fa9d343d
runtime.doInit(...)
        runtime/proc.go:7317
runtime.main()
        runtime/proc.go:254 +0x325 fp=0xc000049fe0 sp=0xc000049f50 pc=0x7ff6fa9c4e85
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc000049fe8 sp=0xc000049fe0 pc=0x7ff6fa9fdb21

goroutine 2 gp=0xc0000028c0 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        runtime/proc.go:435 +0xce fp=0xc00008bfa8 sp=0xc00008bf88 pc=0x7ff6fa9f598e
runtime.goparkunlock(...)
        runtime/proc.go:441
runtime.forcegchelper()
        runtime/proc.go:348 +0xb8 fp=0xc00008bfe0 sp=0xc00008bfa8 pc=0x7ff6fa9c50f8
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc00008bfe8 sp=0xc00008bfe0 pc=0x7ff6fa9fdb21
created by runtime.init.7 in goroutine 1
        runtime/proc.go:336 +0x1a

goroutine 3 gp=0xc000002c40 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        runtime/proc.go:435 +0xce fp=0xc00008df80 sp=0xc00008df60 pc=0x7ff6fa9f598e
runtime.goparkunlock(...)
        runtime/proc.go:441
runtime.bgsweep(0xc00009a000)
        runtime/mgcsweep.go:276 +0x94 fp=0xc00008dfc8 sp=0xc00008df80 pc=0x7ff6fa9ade74
runtime.gcenable.gowrap1()
        runtime/mgc.go:204 +0x25 fp=0xc00008dfe0 sp=0xc00008dfc8 pc=0x7ff6fa9a2285
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc00008dfe8 sp=0xc00008dfe0 pc=0x7ff6fa9fdb21
created by runtime.gcenable in goroutine 1
        runtime/mgc.go:204 +0x66

goroutine 4 gp=0xc000002e00 m=nil [GC scavenge wait]:
runtime.gopark(0xc00009a000?, 0x7ff6fc3ffc10?, 0x1?, 0x0?, 0xc000002e00?)
        runtime/proc.go:435 +0xce fp=0xc0000a1f78 sp=0xc0000a1f58 pc=0x7ff6fa9f598e
runtime.goparkunlock(...)
        runtime/proc.go:441
runtime.(*scavengerState).park(0x7ff6fcfd0d80)
        runtime/mgcscavenge.go:425 +0x49 fp=0xc0000a1fa8 sp=0xc0000a1f78 pc=0x7ff6fa9ab909
runtime.bgscavenge(0xc00009a000)
        runtime/mgcscavenge.go:653 +0x3c fp=0xc0000a1fc8 sp=0xc0000a1fa8 pc=0x7ff6fa9abe7c
runtime.gcenable.gowrap2()
        runtime/mgc.go:205 +0x25 fp=0xc0000a1fe0 sp=0xc0000a1fc8 pc=0x7ff6fa9a2225
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc0000a1fe8 sp=0xc0000a1fe0 pc=0x7ff6fa9fdb21
created by runtime.gcenable in goroutine 1
        runtime/mgc.go:205 +0xa5

goroutine 18 gp=0xc0001081c0 m=nil [finalizer wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        runtime/proc.go:435 +0xce fp=0xc00009de30 sp=0xc00009de10 pc=0x7ff6fa9f598e
runtime.runfinq()
        runtime/mfinal.go:196 +0x107 fp=0xc00009dfe0 sp=0xc00009de30 pc=0x7ff6fa9a1207
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc00009dfe8 sp=0xc00009dfe0 pc=0x7ff6fa9fdb21
created by runtime.createfing in goroutine 1
        runtime/mfinal.go:166 +0x3d
rax     0x64
rbx     0x7ffb9313098c
rcx     0xc687c65efb030000
rdx     0x1c961f50000
rdi     0x1c9e17c0860
rsi     0x0
rbp     0x6f412ff409
rsp     0x6f412feea0
r8      0x7ffffffffffffffc
r9      0x6f410b1000
r10     0x8101010101010100
r11     0x1c96213ad80
r12     0xffffffffffffffff
r13     0x24
r14     0x1c9620ef318
r15     0x0
rip     0x7ffb9306cb12
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b

OS

Windows

GPU

Intel

CPU

Intel

Ollama version

Unknown - ollama --version crashes with the same error before printing version

extent analysis

TL;DR

The most likely fix is to remove or disable the Apple-specific code bundled into the Windows build of Ollama, specifically the MLX imagegen module, which is causing an access violation on startup.

Guidance

  • Identify the MLX imagegen module as the source of the crash and investigate its compatibility with Windows.
  • Check if there are any configuration options or environment variables that can disable the MLX imagegen module on Windows.
  • Consider building Ollama from source with the MLX imagegen module excluded or disabled to test if this resolves the issue.
  • If possible, try running an earlier version of Ollama to see if the issue is specific to a recent change or update.

Example

No specific code example is provided as the issue seems to be related to a build or configuration problem rather than a code snippet that can be easily modified.

Notes

The exact steps to disable or remove the MLX imagegen module may depend on the build process and configuration of Ollama, which is not fully detailed in the provided information. Additionally, without knowing the specific version of Ollama, it's challenging to provide precise instructions.

Recommendation

Apply a workaround by disabling or removing the MLX imagegen module, as it appears to be the cause of the crash on Windows. This approach is chosen because the module seems to be Apple-specific and is not compatible with the Windows environment.

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