invoke-ai/InvokeAI · error · ValueError
Control weights must be within -1 to 2 range
Error message
Control weights must be within -1 to 2 range
What it means
InvokeAI validates control (ControlNet) and IP-Adapter weights via validate_weights, requiring each weight to lie within [-1, 2]. Values outside that range would produce degenerate conditioning or are simply unsupported, so a ValueError is raised.
Source
Thrown at invokeai/app/invocations/util.py:8
from typing import Union
def validate_weights(weights: Union[float, list[float]]) -> None:
"""Validate that all control weights in the valid range"""
to_validate = weights if isinstance(weights, list) else [weights]
if any(i < -1 or i > 2 for i in to_validate):
raise ValueError("Control weights must be within -1 to 2 range")
def validate_begin_end_step(begin_step_percent: float, end_step_percent: float) -> None:
"""Validate that begin_step_percent is less than or equal to end_step_percent"""
if begin_step_percent > end_step_percent:
raise ValueError("Begin step percent must be less than or equal to end step percent")
View on GitHub (pinned to 0b6a024f2f)
Solutions
- Clamp each weight into the [-1, 2] range (e.g. 2.0 instead of 3)
- For lists, ensure every element is within range
- If stronger effect is needed, stack multiple control adapters rather than exceeding the weight cap
Example fix
// before validate_ip_adapter_weight(2.5) // after validate_ip_adapter_weight(min(max(w, -1.0), 2.0) for each w) # e.g. 2.0
Defensive patterns
Strategy: validation
Validate before calling
def validate_weights_client(weights):
vals = weights if isinstance(weights, list) else [weights]
if any(w < -1 or w > 2 for w in vals):
raise ValueError("Control weights must be within -1 to 2 range")
return weights Type guard
def weights_in_range(weights) -> bool:
vals = weights if isinstance(weights, list) else [weights]
return all(isinstance(w, (int, float)) and -1 <= w <= 2 for w in vals) Try / catch
try:
invocation.invoke(context)
except ValueError as e:
if "Control weights must be within -1 to 2 range" in str(e):
invocation.control_weight = [min(max(w, -1.0), 2.0) for w in weights]
invocation.invoke(context)
else:
raise Prevention
- Clamp weights to [-1, 2] when computing them programmatically
- For stronger effect, add another ControlNet unit instead of exceeding the cap
- Sanitize values imported from other tools with different weight conventions
When it happens
Trigger: Calling validate_control_weight or validate_ip_adapter_weight with weight=-1.5, 2.5, or a list containing any element outside [-1, 2]; e.g. controlnet weight field set to 3 in a workflow.
Common situations: Trying aggressive negative conditioning (< -1) to suppress a concept; typing 20 instead of 2.0; copying weights from other tools that allow a wider range.
Related errors
- The Anima ControlNet-LLLite model '{lllite_field.control_mod
- This Anima ControlNet-LLLite adapter is an inpainting adapte
- Unsupported Anima ControlNet-LLLite adapter: expected 3 or 4
- denoising_start ({self.denoising_start}) must be less than d
- LoRA "{lora_key}" already applied to transformer.
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/df866e056af893df.
Report an issue: GitHub.