{"record":{"id":"1a98e078e41a833b","repo":"unslothai/unsloth","slug":"sd-cli-reported-success-but-no-image-at-out-las","errorCode":null,"errorMessage":"sd-cli reported success but no image at {out}. Last output:\n{\"\\n\".join(tail[-12:])}","messagePattern":"sd-cli reported success but no image at (.+?)\\. Last output:\n(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/inference/sd_cpp_engine.py","lineNumber":824,"sourceCode":"                    continue\n                tail.append(line)\n                if len(tail) > 40:\n                    tail.pop(0)\n                if on_log is not None:\n                    on_log(line)\n            ret = proc.wait(timeout = 5.0)\n        finally:\n            if proc.poll() is None:\n                _terminate(proc)\n            # Only once it has actually exited: a pid still running has to stay\n            # recorded, or the next startup has no handle on it.\n            if proc.poll() is not None:\n                forget_pid(proc.pid)\n\n        if ret != 0:\n            raise RuntimeError(f\"sd-cli exited {ret}. Last output:\\n\" + \"\\n\".join(tail[-12:]))\n        if not out.is_file():\n            raise RuntimeError(\n                f\"sd-cli reported success but no image at {out}. Last output:\\n\"\n                + \"\\n\".join(tail[-12:])\n            )\n        logger.info(\"sd-cli run ok in %.1fs -> %s\", time.time() - t0, out)\n        return out\n\n\n# ── engine routing ──────────────────────────────────────────────────────────\n\nENGINE_DIFFUSERS = \"diffusers\"\nENGINE_SD_CPP = \"sd_cpp\"\n\n# Backends diffusers serves well with GPU acceleration; everything else is native-engine territory.\n_GPU_BACKENDS = frozenset({\"cuda\", \"rocm\", \"xpu\"})\n\n\ndef select_diffusion_engine(\n    backend: str,","sourceCodeStart":806,"sourceCodeEnd":842,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/sd_cpp_engine.py#L806-L842","documentation":"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).","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the embedded log tail for save/write errors.","Verify the output directory exists, is writable, and has free space; prefer a short absolute path without spaces.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"out_dir = Path(output_path).parent\nassert out_dir.is_dir() and os.access(out_dir, os.W_OK), f\"output dir not writable: {out_dir}\"\nassert shutil.disk_usage(out_dir).free > 10 * 2**20, \"insufficient disk space for output\"","typeGuard":null,"tryCatchPattern":"try:\n    engine.generate(...)\nexcept RuntimeError as e:\n    if \"no image at\" in str(e):\n        check_output_dir_writability(); rerun_with_absolute_simple_path()\n    raise","preventionTips":["Verify the output directory exists and is writable before each run.","Use absolute output paths without spaces or unusual characters.","Monitor free disk space in long batch pipelines."],"tags":["diffusion","sd-cpp","cli","filesystem"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}