[GH-ISSUE #2381] Image generation on Windows: sd-cli exits 0xC0000135 — lib_dirs points at <CUDA>\bin, the runtime DLLs live in bin\x64 #961

Closed
opened 2026-11-04 01:47:21 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @hogtinbao on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2381

Summary

On Windows the image build records lib_dirs as <CUDA_ROOT>\bin, but CUDA 12/13 ship the runtime libraries in <CUDA_ROOT>\bin\x64. sd-cli.exe is therefore started with a PATH that does not contain cublas64_13.dll, and every image request fails. Image generation is unusable on Windows unless the config is edited by hand.

Environment

  • Strata v0.1.44.1 — the same line is on main
  • Windows 11, RTX 5070 Ti Laptop (12 GB), driver 617.42
  • CUDA Toolkit 13.0.2, installed as the docs suggest: winget install -e --source winget --id Nvidia.CUDA --version 13.0
  • Install itself succeeds: .venv\Scripts\python.exe tools\image\install.py --config strata-iq3_xxs.json builds sd-cli (CUDA) and downloads + SHA-256-verifies all three files (Q6_K 6.27 GB, text encoder 5.1 GB, VAE 0.68 GB)

Steps to reproduce

  1. On Windows, install the CUDA Toolkit 13.0 and run tools/image/install.py for an existing config.
  2. Start the server — GET /health reports "image_generation": true, so the feature is on.
  3. POST /v1/images/generations with {"prompt": "a cat", "size": "512x512"}.

Actual result

HTTP 500
{"error": {"type": "server_error", "code": "image_generation_failed",
           "message": "sd-cli exited with code 3221225781; the end of its log:\n"}}

3221225781 is 0xC0000135 = STATUS_DLL_NOT_FOUND — the loader could not resolve an import of sd-cli.exe. Started from a shell with <CUDA_ROOT>\bin on PATH, sd-cli.exe names the file it wants: cublas64_13.dll.

Root cause

setup.py:3154, in build_image_engine:

lib_dirs = [str(root / "bin")] if WIN else [str(d) for d in (root / "lib64", root / "lib") if d.is_dir()]

tools/image/install.py writes that list into the run config's images.lib_dirs, and serve/server.py:2799 / serve/images.py:135 prepend it to the child's PATH. On a CUDA 13.0.2 install:

<CUDA_ROOT>\bin\*.dll        0 files
<CUDA_ROOT>\bin\x64\*.dll   27 files   (cublas64_13.dll, cublasLt64_13.dll, cudart64_13.dll, ...)

bin holds the tools (nvcc.exe, ptxas.exe, nvlink.exe, ...) — the runtime libraries moved to bin\x64 in CUDA 12. The Linux branch (lib64) is correct, so this is Windows-only.

Suggested fix

List both, the x64 subdirectory first, which covers every CUDA layout:

lib_dirs = ([str(d) for d in (root / "bin" / "x64", root / "bin") if d.is_dir()]
            if WIN else [str(d) for d in (root / "lib64", root / "lib") if d.is_dir()])

Workaround

Add <CUDA_ROOT>\bin\x64 to images.lib_dirs in the run config and restart the server (the images section is copied into the running service at startup). After that the same GPU renders 512×512 in ~21 s and 1024×1024 in ~26 s at Q6_K, so nothing else is wrong here.

Side note

The "the end of its log:" tail is empty in this case, so the user is left with a bare exit code. When a child exits with 0xC0000135, one line saying that a library could not be found would turn this into a one-glance diagnosis.

Originally created by @hogtinbao on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2381 ## Summary On Windows the image build records `lib_dirs` as `<CUDA_ROOT>\bin`, but CUDA 12/13 ship the runtime libraries in `<CUDA_ROOT>\bin\x64`. `sd-cli.exe` is therefore started with a `PATH` that does not contain `cublas64_13.dll`, and every image request fails. Image generation is unusable on Windows unless the config is edited by hand. ## Environment - Strata v0.1.44.1 — the same line is on `main` - Windows 11, RTX 5070 Ti Laptop (12 GB), driver 617.42 - CUDA Toolkit 13.0.2, installed as the docs suggest: `winget install -e --source winget --id Nvidia.CUDA --version 13.0` - Install itself succeeds: `.venv\Scripts\python.exe tools\image\install.py --config strata-iq3_xxs.json` builds `sd-cli` (CUDA) and downloads + SHA-256-verifies all three files (`Q6_K` 6.27 GB, text encoder 5.1 GB, VAE 0.68 GB) ## Steps to reproduce 1. On Windows, install the CUDA Toolkit 13.0 and run `tools/image/install.py` for an existing config. 2. Start the server — `GET /health` reports `"image_generation": true`, so the feature is on. 3. `POST /v1/images/generations` with `{"prompt": "a cat", "size": "512x512"}`. ## Actual result ``` HTTP 500 {"error": {"type": "server_error", "code": "image_generation_failed", "message": "sd-cli exited with code 3221225781; the end of its log:\n"}} ``` `3221225781` is `0xC0000135` = `STATUS_DLL_NOT_FOUND` — the loader could not resolve an import of `sd-cli.exe`. Started from a shell with `<CUDA_ROOT>\bin` on `PATH`, `sd-cli.exe` names the file it wants: `cublas64_13.dll`. ## Root cause `setup.py:3154`, in `build_image_engine`: ```python lib_dirs = [str(root / "bin")] if WIN else [str(d) for d in (root / "lib64", root / "lib") if d.is_dir()] ``` `tools/image/install.py` writes that list into the run config's `images.lib_dirs`, and `serve/server.py:2799` / `serve/images.py:135` prepend it to the child's `PATH`. On a CUDA 13.0.2 install: ``` <CUDA_ROOT>\bin\*.dll 0 files <CUDA_ROOT>\bin\x64\*.dll 27 files (cublas64_13.dll, cublasLt64_13.dll, cudart64_13.dll, ...) ``` `bin` holds the tools (`nvcc.exe`, `ptxas.exe`, `nvlink.exe`, ...) — the runtime libraries moved to `bin\x64` in CUDA 12. The Linux branch (`lib64`) is correct, so this is Windows-only. ## Suggested fix List both, the `x64` subdirectory first, which covers every CUDA layout: ```python lib_dirs = ([str(d) for d in (root / "bin" / "x64", root / "bin") if d.is_dir()] if WIN else [str(d) for d in (root / "lib64", root / "lib") if d.is_dir()]) ``` ## Workaround Add `<CUDA_ROOT>\bin\x64` to `images.lib_dirs` in the run config and restart the server (the `images` section is copied into the running service at startup). After that the same GPU renders 512×512 in ~21 s and 1024×1024 in ~26 s at `Q6_K`, so nothing else is wrong here. ## Side note The "the end of its log:" tail is empty in this case, so the user is left with a bare exit code. When a child exits with `0xC0000135`, one line saying that a library could not be found would turn this into a one-glance diagnosis.
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6270999286 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#961
No description provided.