{"record":{"id":"93a81be1b00e130e","repo":"unslothai/unsloth","slug":"sd-server-binary-is-present-but-not-runnable","errorCode":null,"errorMessage":"sd-server binary is present but not runnable.","messagePattern":"sd-server binary is present but not runnable\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/inference/sd_cpp_backend.py","lineNumber":1316,"sourceCode":"            if mode == \"server\":\n                # Probe the server binary before the pull: a present-but-unrunnable build would download everything then fail.\n                assert server_binary is not None\n                if not _server_binary_runnable(server_binary):\n                    logger.warning(\n                        \"sd-server at %s is present but not runnable; trying one-shot sd-cli.\",\n                        server_binary,\n                    )\n                    # Resolve ONCE and keep it: two calls can answer with two different\n                    # binaries if an install lands between them, and the state below reads the\n                    # accelerator off whichever object it ends up holding.\n                    fallback: Optional[SdCppEngine] = None\n                    try:\n                        fallback = self._resolve_engine()\n                        usable = fallback.version() is not None\n                    except Exception:  # noqa: BLE001\n                        usable = False\n                    if not usable or fallback is None:\n                        raise RuntimeError(\"sd-server binary is present but not runnable.\")\n                    mode, server_binary, engine = \"oneshot\", None, fallback\n            # The accelerator the managed tree held when THIS binary was chosen, taken where the\n            # choice is made rather than sampled again later. The asset download below runs for\n            # minutes with no claim on the tree, and an install that lands in that window replaces\n            # sd-server in place: same path, still runnable, a different build. \"It exists and it\n            # runs\" is therefore not evidence that it is the build this load resolved its device\n            # and offload policy for, so the answer is re-asked under the reader claim.\n            server_accelerator = _installed_accelerator_of(server_binary)\n            # The same pin for the one-shot CLI, and for the same reason. Sampling it only at\n            # state construction, after the download, would record whatever an install left in\n            # the tree in that window and the first generation -- which re-reads the tree and\n            # compares -- would then agree with the replacement, so the check that exists to\n            # notice a swap could never fire for one that landed during the download.\n            engine_accelerator = _installed_accelerator_of(getattr(engine, \"binary\", None))\n            if mode == \"oneshot\":\n                # version() is None when a present binary can't run; fail now, not on the first generation.\n                assert engine is not None\n                if engine.version() is None:","sourceCodeStart":1298,"sourceCodeEnd":1334,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/sd_cpp_backend.py#L1298-L1334","documentation":"RuntimeError on the load path: a persistent sd-server binary exists at the expected path, but when the engine tried to resolve a fallback sd-cli engine its version() came back None (or resolution raised), meaning the present binary cannot actually run. The load aborts now rather than failing on first generation.","triggerScenarios":"Load in server mode finds the server unusable, falls back to one-shot, and the fallback binary also fails to execute (version() is None) — corrupted binary, missing dynamic libraries, wrong architecture.","commonSituations":"Truncated/partially downloaded managed binary; system library mismatch (libstdc++, CUDA runtime) after an OS upgrade; a binary copied from another architecture.","solutions":["Run the binary directly (`<path>/sd-server --version` and `sd-cli --version`) to see the real exec error (missing .so, exec format error).","Delete the managed binary tree and let the backend reinstall a fresh copy.","Install missing runtime libraries reported by ldd, or point SD_CLI_PATH at a known-good build.","Retrying the load after the fix re-resolves device and binaries from scratch."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import subprocess\n\ndef binary_runs(path: str) -> bool:\n    try:\n        return subprocess.run([path, '--version'], capture_output=True, timeout=20).returncode == 0\n    except Exception:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    backend.begin_load(repo_id=r, gguf_filename=f)\nexcept RuntimeError as e:\n    if 'not runnable' in str(e):\n        reinstall_managed_binary()\n        backend.begin_load(repo_id=r, gguf_filename=f)  # retry re-resolves from scratch\n    raise","preventionTips":["Smoke-test the managed binaries (--version) after every backend/OS update.","Keep system runtime libraries (libstdc++, CUDA stubs) consistent with the binary build."],"tags":["binary-validation","installation","environment","sd-cpp"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}