unslothai/unsloth · error · RuntimeError

sd-cli reported success but no image at {out}. Last output:

Error message

sd-cli reported success but no image at {out}. Last output:
{"\n".join(tail[-12:])}

What it means

sd-cli exited 0 but the expected output image file does not exist. _prepare_out deletes any stale file before the run, so is_file() proves this run actually wrote the image. This catches the failure mode where the CLI succeeds nominally but writes nothing (wrong output flag, write failure swallowed, or an output path the process cannot write to).

Source

Thrown at studio/backend/core/inference/sd_cpp_engine.py:824

                    continue
                tail.append(line)
                if len(tail) > 40:
                    tail.pop(0)
                if on_log is not None:
                    on_log(line)
            ret = proc.wait(timeout = 5.0)
        finally:
            if proc.poll() is None:
                _terminate(proc)
            # Only once it has actually exited: a pid still running has to stay
            # recorded, or the next startup has no handle on it.
            if proc.poll() is not None:
                forget_pid(proc.pid)

        if ret != 0:
            raise RuntimeError(f"sd-cli exited {ret}. Last output:\n" + "\n".join(tail[-12:]))
        if not out.is_file():
            raise RuntimeError(
                f"sd-cli reported success but no image at {out}. Last output:\n"
                + "\n".join(tail[-12:])
            )
        logger.info("sd-cli run ok in %.1fs -> %s", time.time() - t0, out)
        return out


# ── engine routing ──────────────────────────────────────────────────────────

ENGINE_DIFFUSERS = "diffusers"
ENGINE_SD_CPP = "sd_cpp"

# Backends diffusers serves well with GPU acceleration; everything else is native-engine territory.
_GPU_BACKENDS = frozenset({"cuda", "rocm", "xpu"})


def select_diffusion_engine(
    backend: str,

View on GitHub (pinned to 203007d190)

Solutions

  1. Check the embedded log tail for save/write errors.
  2. Verify the output directory exists, is writable, and has free space; prefer a short absolute path without spaces.
  3. Reproduce with the same args manually to see where (or whether) the CLI writes the file; if it writes a different name/extension, align the expected path.
Defensive patterns

Strategy: validation

Validate before calling

out_dir = Path(output_path).parent
assert out_dir.is_dir() and os.access(out_dir, os.W_OK), f"output dir not writable: {out_dir}"
assert shutil.disk_usage(out_dir).free > 10 * 2**20, "insufficient disk space for output"

Try / catch

try:
    engine.generate(...)
except RuntimeError as e:
    if "no image at" in str(e):
        check_output_dir_writability(); rerun_with_absolute_simple_path()
    raise

Prevention

When it happens

Trigger: The CLI accepts the output path argument but writes elsewhere (path quoting/spacing issues), or silently fails to save (disk full, permission denied, unsupported save format).

Common situations: Output directory on a read-only mount; path containing characters the CLI mishandles; disk-full conditions where the PNG write fails without a non-zero exit.

Related errors


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