invoke-ai/InvokeAI · error · ValueError
stop must be greater than start
Error message
stop must be greater than start
What it means
A Pydantic field_validator on the RangeInvocation enforces that stop is strictly greater than start whenever start is present in the validated data. This runs at input validation time, before invoke().
Solutions
- Swap the values so stop > start.
- If a descending range is intended, this node does not support it via validation — build the collection in code instead.
- Add UI/client-side validation so start/stop are checked before submitting the graph.
Example fix
// before RangeInvocation(start=10, stop=1, step=-1) // after RangeInvocation(start=1, stop=10, step=1) # then reverse the collection if needed
Defensive patterns
Strategy: validation
Validate before calling
if stop <= start:
raise ValueError(f"stop ({stop}) must be greater than start ({start})") Try / catch
try:
node = RangeInvocation(start=start, stop=stop, step=step)
except ValidationError as e:
log_and_correct_range_bounds(e) Prevention
- Compute stop as start + count rather than independently
- Validate bounds at the client before submitting graphs
- Remember descending ranges are rejected by the validator
When it happens
Trigger: Creating/queueing a Range node with stop <= start (e.g. start=10, stop=10, or start=5, stop=2). Note a reversed range like start=10, stop=1 with step=-1 also fails because the check requires strict inequality.
Common situations: Computing start/stop from variables where a swap accidentally reversed them; default edits in the UI; users expecting Python-style descending range() with negative step.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- A workflow may not contain more than one workflow_return…
- base_url must not start with reserved path segment '/
- Cannot divide by zero
- cfg_scale must be greater than 1
- cfg_scale must be greater than 1
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/844fe3be064e0d58.
Report an issue: GitHub.
Appendix: source
Thrown at invokeai/app/invocations/collections.py:25
from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation
from invokeai.app.invocations.fields import InputField
from invokeai.app.invocations.primitives import IntegerCollectionOutput
from invokeai.app.services.shared.invocation_context import InvocationContext
from invokeai.app.util.misc import SEED_MAX
@invocation("range", title="Integer Range", tags=["collection", "integer", "range"], category="batch", version="1.0.0")
class RangeInvocation(BaseInvocation):
"""Creates a range of numbers from start to stop with step"""
start: int = InputField(default=0, description="The start of the range")
stop: int = InputField(default=10, description="The stop of the range")
step: int = InputField(default=1, description="The step of the range")
@field_validator("stop")
def stop_gt_start(cls, v: int, info: ValidationInfo):
if "start" in info.data and v <= info.data["start"]:
raise ValueError("stop must be greater than start")
return v
def invoke(self, context: InvocationContext) -> IntegerCollectionOutput:
return IntegerCollectionOutput(collection=list(range(self.start, self.stop, self.step)))
@invocation(
"range_of_size",
title="Integer Range of Size",
tags=["collection", "integer", "size", "range"],
category="batch",
version="1.0.0",
)
class RangeOfSizeInvocation(BaseInvocation):
"""Creates a range from start to start + (size * step) incremented by step"""
start: int = InputField(default=0, description="The start of the range")
size: int = InputField(default=1, gt=0, description="The number of values")View on GitHub (pinned to 0b6a024f2f)