unslothai/unsloth · error · ValueError
{state.family.name} is an image-editing model and does not s
Error message
{state.family.name} is an image-editing model and does not support masks (mask_image). What it means
Edit-capable families have no inpaint pipeline, so a mask_image would be silently dropped if accepted. This ValueError rejects a request that supplies mask_image to an editing family before any work starts, telling the caller to use the instruction prompt instead of a mask.
Source
Thrown at studio/backend/core/inference/diffusion.py:5362
raise ValueError("mask_image requires an input image (init_image).")
if upscale is not None and upscale > 1.0:
raise ValueError("upscale requires an input image (init_image).")
if reference_images:
raise ValueError("reference_images require an input image (init_image).")
if reference_images and not getattr(state.family, "reference", False):
raise ValueError(
f"Reference images are not supported for the '{state.family.name}' "
"model family."
)
if getattr(state.family, "edit", False):
# Instruction editing: the loaded pipe IS the edit pipeline and always needs an input image; the prompt is the instruction.
if init_image is None:
raise ValueError(
f"{state.family.name} is an image-editing model: provide an input image."
)
if mask_image is not None:
# The edit family has no inpaint pipeline; a mask would be silently dropped.
raise ValueError(
f"{state.family.name} is an image-editing model and does not "
"support masks (mask_image)."
)
workflow = "edit"
init_pil = decode_b64_image(init_image, mode = "RGB")
elif mask_image is not None and init_image is not None:
workflow = "inpaint"
pipe = self._workflow_pipe(state, state.family.inpaint_pipeline_class, workflow)
init_pil = decode_b64_image(init_image, mode = "RGB")
mask_pil = decode_b64_image(mask_image, mode = "L")
elif init_image is not None and upscale is not None and upscale > 1.0:
# Upscale (hires fix): enlarge with Lanczos, then re-run img2img at low strength to add detail.
workflow = "upscale"
pipe = self._workflow_pipe(state, state.family.img2img_pipeline_class, workflow)
init_pil = decode_b64_image(init_image, mode = "RGB")
iw, ih = init_pil.size
# Cap the factor, then the absolute output (longest side 2048); round to a multiple of 16 (VAE downsample + patch).
factor = max(1.0, min(float(upscale), 4.0))View on GitHub (pinned to 203007d190)
Solutions
- Remove mask_image and express the edit through the prompt instruction (e.g. 'replace the masked region concept' via natural language).
- Load an inpaint-capable family if mask-based editing is required.
Example fix
# before engine.generate(prompt="repaint", init_image=img, mask_image=mask) # after (edit family) engine.generate(prompt="change the hair color to red", init_image=img)
Defensive patterns
Strategy: validation
Validate before calling
if getattr(loaded_family, "edit", False) and mask_image is not None:
raise UserError("Edit models take instructions, not masks: remove mask_image.") Type guard
def family_accepts_mask(family) -> bool:
return not bool(getattr(family, "edit", False)) Try / catch
try:
out = engine.generate(prompt=p, init_image=img, mask_image=mask)
except ValueError as e:
if "does not support masks" in str(e):
out = engine.generate(prompt=mask_intent_as_instruction, init_image=img)
else:
raise Prevention
- Hide the mask/inpaint canvas when an edit family is loaded.
- Translate painted-mask intents into natural-language instructions for edit models.
When it happens
Trigger: A request with mask_image set while the loaded family has edit=True (the mask+init_image combination would normally select the inpaint workflow, which does not exist for edit families).
Common situations: Porting an inpainting workflow (mask + init image) to a newer instruction-editing model and assuming mask semantics carry over; UI state where an old painted mask is still attached after loading an edit model.
Related errors
- mask_image requires an input image (init_image).
- {state.family.name} is an image-editing model: provide an in
- Unknown model_kind '{model_kind}'. Expected one of {sorted(_
- Invalid base64 image data: {exc}
- Image is too large ({w}x{h}); maximum is {max_side}px per si
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/6389a573a3e5cc14.
Report an issue: GitHub.