Local generation fails on Windows: sd-cli.exe exits with code 3221225781 (0xC0000135 — missing debug CRT DLLs)
Description
When using Local Models on Windows 11, clicking Generate fails immediately with:
Error: Error invoking remote method 'local-ai:generate': Error: sd-cli exited (code 3221225781):3221225781 = 0xC0000135 (STATUS_DLL_NOT_FOUND). This happens with every local model tested (both "Z-Image Turbo" and "Z-Image Base") — the bundled sd-cli.exe under local-ai/bin/ fails to even launch.
Root cause
This matches a known upstream issue in stable-diffusion.cpp: leejet/stable-diffusion.cpp#1165. The bundled sd-cli.exe / stable-diffusion.dll appears to be a Debug build, which requires debug-only CRT DLLs that normal end-user machines don't have installed:
- MSVCP140D.dll
- VCRUNTIME140_1D.dll
- VCRUNTIME140D.dll
- ucrtbased.dll
These ship only with Visual Studio's C++ workload, not with the regular VC++ Redistributable, so essentially no end user has them by default.
Steps to reproduce
- Install Open Generative AI v2.0.0 on Windows 11 (Open.Generative.AI.Setup.2.0.0.exe)
- Settings -> Local Models -> download a Z-Image model (both Turbo and Base reproduce this)
- Switch to "Local" mode, select the model, enter a prompt, click Generate
- Immediately get: Error: sd-cli exited (code 3221225781)
Expected behavior
Local generation should work out of the box without requiring Visual Studio to be installed.
Suggested fix
Rebuild/re-bundle sd-cli.exe, stable-diffusion.dll and related binaries under local-ai/bin/ in Release mode (not Debug) so they only depend on the standard redistributable CRT.
Additional (possibly related) issue observed
Separately, after a large model download (Z-Image Base, 5 GB) actually completes successfully on disk (correct final size), the app sometimes still throws a JS error dialog:
Uncaught Exception: Error: ENOENT: no such file or directory, rename '...\z-image-Q4_K_M.gguf.part' -> '...\z-image-Q4_K_M.gguf' at Object.renameSync (node:fs:1033:11) at WriteStream. (...\resources\app.asar\electron\lib\localInference.js:120:41)
even though the rename actually succeeded and the file is intact. Looks like the download-finish/rename handler may fire twice.
Environment
- OS: Windows 11
- App version: v2.0.0 (installer build)
- Settings -> Local Models shows "sd.cpp inference engine: Installed and ready", but generation still fails for every local model.
Source: Anil-matcha/Open-Generative-AI