{"record":{"id":"bf837ae1fc17f623","repo":"unslothai/unsloth","slug":"the-executable-at-binary-is-not-stable-diffusion","errorCode":null,"errorMessage":"The executable at {binary} is not stable-diffusion.cpp: its --help output does not identify the project. Point SD_CLI_PATH at a stable-diffusion.cpp build from master-812-ea7f0c8 or newer, or UNSLOTH_SD_CPP_PATH at the directory holding one{_h3_replacement_hint(binary)}.","messagePattern":"The executable at (.+?) is not stable-diffusion\\.cpp: its --help output does not identify the project\\. Point SD_CLI_PATH at a stable-diffusion\\.cpp build from master-812-ea7f0c8 or newer, or UNSLOTH_SD_CPP_PATH at the directory holding one(.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":409,"severity":"error","filePath":"studio/backend/core/inference/sd_cpp_backend.py","lineNumber":502,"sourceCode":"    # the class of program #8507 was about -- through SD_CLI_PATH instead of PATH. Upstream added\n    # H3 eight months after print_usage started with the project banner, so a genuine H3 build\n    # always answers both.\n    identified = help_text_identifies_sd_cpp(help_text)\n    if identified and help_text_supports_minimax_h3(help_text):\n        return binary\n    # What is wrong with it, for the log lines on the managed path below: a managed copy that is not\n    # sd.cpp at all is still deleted and reinstalled, but calling it an old build would be false.\n    fault = \"does not advertise MiniMax-H3 support\" if identified else \"is not stable-diffusion.cpp\"\n    if not is_managed_binary(binary):\n        # Not an old sd.cpp -- not sd.cpp at all. Worth its own message: the H3 marker is missing\n        # from EVERY program that is not stable-diffusion.cpp, so reporting the capability verdict\n        # here sent users hunting for a newer build of something they never installed (#8507, where\n        # the binary was Debian/Ubuntu's `sd` find-and-replace tool). Discovery already skips an\n        # unrelated PATH `sd`, so what reaches this line came from somewhere the identity gate does\n        # not cover -- an SD_CLI_PATH / UNSLOTH_SD_CPP_PATH override, an in-tree developer build, or\n        # a PATH `sd-cli`. None of them is ours to overwrite, so all four say so and stop.\n        if not identified:\n            raise RuntimeError(\n                f\"The executable at {binary} is not stable-diffusion.cpp: its --help output does \"\n                f\"not identify the project. Point SD_CLI_PATH at a stable-diffusion.cpp build from \"\n                f\"master-812-ea7f0c8 or newer, or UNSLOTH_SD_CPP_PATH at the directory holding one\"\n                f\"{_h3_replacement_hint(binary)}.\"\n            )\n        raise RuntimeError(\n            f\"The stable-diffusion.cpp binary at {binary} does not advertise MiniMax-H3 support \"\n            f\"(its --help does not list the H3 options), so generation would fail on it. \"\n            f\"Point SD_CLI_PATH at a build from master-812-ea7f0c8 or \"\n            f\"newer, or UNSLOTH_SD_CPP_PATH at the directory holding one\"\n            f\"{_h3_replacement_hint(binary)}.\"\n        )\n    if not allow_install:\n        # Ours, but replacing it is exactly what auto-install is switched off for.\n        logger.warning(\"managed sd.cpp binary %s %s\", binary, fault)\n        return None\n    # Deleting it is a WRITE to the managed tree, so it takes the same admission an install does.\n    # An image one-shot may be executing this very file: on Linux the running child survives the","sourceCodeStart":484,"sourceCodeEnd":520,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/sd_cpp_backend.py#L484-L520","documentation":"Raised by the managed-binary validation gate when the executable resolved for sd.cpp generation runs --help and the output does not identify the stable-diffusion.cpp project. The gate exists because the H3 capability marker is absent from every non-sd.cpp program, so misreporting it as an 'old build' would send users hunting for updates to something they never installed (issue #8507, where Debian/Ubuntu's `sd` find-and-replace tool was picked up). Because the binary is not managed (it came from SD_CLI_PATH / UNSLOTH_SD_CPP_PATH, an in-tree developer build, or a PATH `sd-cli`), the backend refuses to overwrite it and stops.","triggerScenarios":"Setting SD_CLI_PATH or UNSLOTH_SD_CPP_PATH to a directory containing an unrelated binary named `sd`/`sd-cli` (e.g. the Debian `sd` sed-clone); having an in-tree developer build that is actually a different program; a PATH `sd-cli` that is not stable-diffusion.cpp. Any call that reaches _resolve_engine()/ensure_sd_cpp_binary() with such a binary on a generation or load path.","commonSituations":"Installing the Debian/Ubuntu `sd` package (find-and-replace tool) which shadows the expected name; copy-pasting an export SD_CLI_PATH=... line pointing at the wrong directory; a broken or truncated binary whose --help emits nothing recognizable.","solutions":["Point SD_CLI_PATH at a genuine stable-diffusion.cpp executable built from master-812-ea7f0c8 or newer (or UNSLOTH_SD_CPP_PATH at the directory holding one).","Run `<binary> --help` yourself and confirm it identifies stable-diffusion.cpp; if it does not, replace or rebuild that binary.","Unset the override so the backend installs its own managed copy: unset SD_CLI_PATH UNSLOTH_SD_CPP_PATH.","If a PATH `sd-cli` is the culprit, remove/rename it so discovery skips it."],"exampleFix":"# before\nexport SD_CLI_PATH=/usr/bin/sd  # Debian find-and-replace tool\n\n# after\nexport SD_CLI_PATH=/opt/sd.cpp-build/sd-cli  # real stable-diffusion.cpp build >= master-812-ea7f0c8","handlingStrategy":"validation","validationCode":"import subprocess\n\ndef is_stable_diffusion_cpp(binary: str) -> bool:\n    try:\n        out = subprocess.run([binary, '--help'], capture_output=True, text=True, timeout=15)\n    except Exception:\n        return False\n    return 'stable-diffusion' in (out.stdout + out.stderr).lower()","typeGuard":null,"tryCatchPattern":"try:\n    engine = backend._resolve_engine()\nexcept RuntimeError as e:\n    if 'is not stable-diffusion.cpp' in str(e):\n        raise SystemExit('Fix SD_CLI_PATH/UNSLOTH_SD_CPP_PATH to point at a real sd.cpp build')\n    raise","preventionTips":["Validate any SD_CLI_PATH/UNSLOTH_SD_CPP_PATH override with a --help identity check before starting the studio.","Do not install the Debian/Ubuntu `sd` package on hosts that run this backend.","Prefer the managed auto-install over PATH overrides unless you pin builds deliberately."],"tags":["configuration","binary-validation","environment","sd-cpp"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}