odysseus-dev/odysseus · error · HTTPException
MLX Swift bridge completed but did not write {out_path}
Error message
MLX Swift bridge completed but did not write {out_path} What it means
Raised in /v1/images/edits of scripts/mlx_image_server.py with HTTP 500 when the MLX Swift bridge (DDColor colorize or LaMa/MI-GAN inpaint) exited successfully but did not create the promised out_path image.png in the per-request temp directory. It is the edits-path twin of error 956.
Source
Thrown at scripts/mlx_image_server.py:410
n: int = Form(1),
size: str = Form("1024x1024"),
response_format: str = Form("b64_json"),
):
active_model = model or _args.model
if _is_lama_inpaint(active_model) or _is_ddcolor(active_model):
image_raw = await image.read()
mask_raw = await mask.read() if mask is not None else None
out_images = []
count = max(1, min(int(n or 1), 4))
for _ in range(count):
with tempfile.TemporaryDirectory(prefix="odysseus-mlx-edit-") as td:
out_path = Path(td) / "image.png"
if _is_ddcolor(active_model):
_run_ddcolor_bridge(active_model, image_raw, out_path)
else:
_run_inpaint_bridge(active_model, image_raw, mask_raw, out_path)
if not out_path.exists():
raise HTTPException(500, f"MLX Swift bridge completed but did not write {out_path}")
out_images.append({"b64_json": base64.b64encode(out_path.read_bytes()).decode("ascii")})
return {"created": 0, "data": out_images}
raise HTTPException(
422,
"This MLX image endpoint supports text-to-image generation only. "
"Use /v1/images/generations, or serve an edit/img2img-capable model.",
)
@app.post("/v1/images/harmonize")
def harmonize_image(req: HarmonizeRequest):
active_model = _args.model
if _is_lama_inpaint(active_model) or _is_ddcolor(active_model):
try:
image_raw = base64.b64decode(req.image.split(",", 1)[-1])
mask_b64 = req.body_mask or req.mask
mask_raw = base64.b64decode(mask_b64.split(",", 1)[-1]) if mask_b64 else None
except Exception as e:View on GitHub (pinned to f9235ebbf1)
Solutions
- Run the bridge command manually with the same args in a kept directory and see where/whether it writes
- Pin the bridge package to the version whose --output contract matches the server
- Check the process can write to the temp dir (try a manual touch as the same user; inspect macOS sandbox/profile denial)
- Reinstall the bridge if it silently no-ops (e.g. missing weights bundled at build time)
Defensive patterns
Strategy: fallback
Validate before calling
import shutil, subprocess, tempfile, pathlib
bridge = shutil.which('odysseus-mlx-inpaint')
with tempfile.TemporaryDirectory() as td:
out = pathlib.Path(td) / 'o.png'
subprocess.run([bridge, '--model', w, '--image', i, '--mask', m, '--output', str(out), '--mode', 'inpaint'], check=True)
assert out.exists(), 'bridge output contract broken' Try / catch
except HTTPException as e:
if 'did not write' in str(e.detail):
out_path = rerun_bridge_with_kept_dir_and_locate() # fallback: capture actual write location
else:
raise Prevention
- Contract-test each bridge version after upgrade
- Run the bridge in a kept directory once to learn its real output layout
- Pin bridge package versions alongside the server
When it happens
Trigger: A bridge call returns exit code 0 yet writes nothing or writes to another path: bridge version whose --output semantics changed, bridge succeeding on a dry-run/help invocation, sandboxed Swift process blocked from writing the temp dir.
Common situations: Upgraded odysseus-mlx-inpaint/mlx-lama-serve CLI where flags were renamed; temp dir under /var/folders hit by sandbox restrictions for signed binaries; out_path passed as a file:// URL vs plain path mismatch across versions.
Related errors
- detail[-4000:]
- MLX image generator completed but did not write {out_path}
- No safetensors weights found for {model} in {snap}
- HiDream generator script not found in snapshot: {script}
- Boogu MLX generation failed: {e}
AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14).
Data as JSON: /api/errors/7247c4811d01f103.
Report an issue: GitHub.