unslothai/unsloth · error · RuntimeError

The stable-diffusion.cpp binary was replaced by an install f

Error message

The stable-diffusion.cpp binary was replaced by an install for a different accelerator while this model was loading. Try the load again.

What it means

The one-shot counterpart of the server swap check: after the load's downloads, _installed_accelerator_of(engine.binary) differs from the accelerator pinned when the CLI was vetted. The refusal happens at load rather than being recorded in state, because recording the replacement would make every later per-generation comparison agree with the wrong build forever.

Source

Thrown at studio/backend/core/inference/sd_cpp_backend.py:1591

                        # download, inside the claim, and holding it to the pre-download answer
                        # would refuse the fallback on an install this load already lived through.
                        engine_accelerator = _installed_accelerator_of(
                            getattr(fallback, "binary", None)
                        )
                        mode = "oneshot"
                    finally:
                        if not started_ok:
                            with self._lock:
                                if self._pending_server is started:
                                    self._pending_server = None
                if mode == "oneshot" and (
                    _installed_accelerator_of(getattr(engine, "binary", None)) != engine_accelerator
                ):
                    # Runnable, at the same path, and still not the build this load vetted -- the
                    # one-shot half of the check the server path makes just above. Refused at load
                    # rather than recorded, because recording the replacement is what makes the
                    # per-generation comparison agree with it forever after.
                    raise RuntimeError(
                        "The stable-diffusion.cpp binary was replaced by an install for a "
                        "different accelerator while this model was loading. Try the load again."
                    )
                state = _SdState(
                    repo_id = repo_id,
                    base_repo = base,
                    family = fam,
                    device = device,
                    files = files,
                    vae_format = fam.sd_cpp_vae_format,
                    native_speed = native_speed,
                    # Pinned against the binary this load COMMITTED to, which a deferred install or
                    # a one-shot fallback may have changed since the policy was built.
                    offload_flags = tuple(
                        _offload_with_device_pin_impl(
                            offload,
                            server_binary if mode == "server" else getattr(engine, "binary", None),
                            gpu_ordinal,

View on GitHub (pinned to 203007d190)

Solutions

  1. Retry the load; it re-resolves device, accelerator and install from scratch.
  2. Serialize model loads to prevent install/load interleaving.
  3. Avoid triggering CPU-fallback loads concurrently with GPU loads (or pre-install the accelerator you intend to use).
Defensive patterns

Strategy: retry

Try / catch

try:
    backend.begin_load(repo_id=r, gguf_filename=f)
except RuntimeError as e:
    if 'replaced by an install for a different accelerator' in str(e):
        backend.begin_load(repo_id=r, gguf_filename=f)
    else:
        raise

Prevention

When it happens

Trigger: One-shot mode load whose sd-cli binary is replaced in place by an install for another accelerator during the asset download window.

Common situations: Concurrent loads with different device targets; auto-install of a CPU fallback bundle while a GPU one-shot load is pulling assets.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/e6ca5d2dba921431. Report an issue: GitHub.