Comfy-Org/ComfyUI · error · ValueError
INVALID_QUERY
INVALID_QUERY
Error message
metadata_filter must be JSON: {e} What it means
Raised by LatentBlend.blend_mode when the blend_mode string passed to LatentBlend.blend is anything other than "normal". The blend method's Python signature accepts any string (blend_mode: str = "normal") and the UI combo does not enumerate the extra modes, so this guard exists to reject values the implementation never handles. The node only implements the "normal" blend (which simply returns img2 before the factor mix).
Source
Thrown at app/assets/api/schemas_in.py:105
return [t.strip() for t in v.split(",") if t.strip()]
if isinstance(v, list):
out: list[str] = []
for item in v:
if isinstance(item, str):
out.extend([t.strip() for t in item.split(",") if t.strip()])
return out
return v
@field_validator("metadata_filter", mode="before")
@classmethod
def _parse_metadata_json(cls, v):
if v is None or isinstance(v, dict):
return v
if isinstance(v, str) and v.strip():
try:
parsed = json.loads(v)
except Exception as e:
raise ValueError(f"metadata_filter must be JSON: {e}") from e
if not isinstance(parsed, dict):
raise ValueError("metadata_filter must be a JSON object")
return parsed
return None
class UpdateAssetBody(BaseModel):
name: str | None = None
user_metadata: dict[str, Any] | None = None
preview_id: str | None = None # references an asset_reference id, not an asset id
@model_validator(mode="after")
def _validate_at_least_one_field(self):
if all(
v is None
for v in (self.name, self.user_metadata, self.preview_id)
):
raise ValueError(View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Omit blend_mode entirely (it defaults to "normal") or set it to exactly "normal" — lowercase, exact match.
- If you need other blend behaviors, implement them yourself on the LATENT tensors before/after LatentBlend, or use a dedicated compositing node.
- Audit API prompts and custom frontends for hardcoded blend_mode strings and remove or correct them.
Example fix
# before result = latent_blend.blend(samples1, samples2, 0.5, blend_mode="multiply") # after result = latent_blend.blend(samples1, samples2, 0.5) # blend_mode defaults to "normal"
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_BLEND_MODES = {"normal"}
def blend_mode_ok(mode: str) -> bool:
return mode in SUPPORTED_BLEND_MODES Type guard
def is_supported_blend_mode(mode: str) -> bool:
return isinstance(mode, str) and mode == "normal" Try / catch
try:
out = latent_blend.blend(samples1, samples2, blend_factor, blend_mode)
except ValueError as e:
if "Unsupported blend mode" in str(e):
out = latent_blend.blend(samples1, samples2, blend_factor) # fall back to "normal"
else:
raise Prevention
- Omit blend_mode in API prompts unless you explicitly pass "normal".
- Treat the node's combo/default as the source of truth; do not invent mode names.
- For non-normal blending, precompute blended LATENT tensors in your own node instead of passing unsupported strings.
When it happens
Trigger: Calling LatentBlend.blend programmatically (API prompt or custom node) with blend_mode set to e.g. "multiply", "screen", or any non-default string; a saved workflow or frontend extension exposing blend-mode options that the node implementation does not support; typos like "Normal" (case-sensitive check).
Common situations: Custom scripts building API prompts that assume image-editor blend modes exist on the latent blend node; third-party UI extensions adding a blend-mode dropdown with unsupported values; porting workflows between forks where LatentBlend gained modes but upstream never did.
Related errors
- INVALID_TAG_FILTER
- Unknown SeedVR2 VAE forward mode: {mode}
- Invalid return type from node: {type(to_return)}
- Node {cls.__name__} is not expandable, but expand included i
- Connect at least one keyframe image.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/23dd5d1a1b608b17.
Report an issue: GitHub.