unslothai/unsloth · error · ValueError
seeds supports at most {MAX_BATCH_IMAGES} entries per call
Error message
seeds supports at most {MAX_BATCH_IMAGES} entries per call What it means
The seeds list is capped at MAX_BATCH_IMAGES = 32 entries per call, symmetrically with the prompts cap, so one request cannot schedule an unbounded batch. Longer seed lists must be split across calls.
Source
Thrown at studio/backend/core/inference/diffusion_batched.py:69
- ``prompts`` (list): one image per prompt. With ``seeds`` too, lengths must
match (seed i drives prompt i); without, seeds derive from the base.
- ``seeds`` (list) alone: one image per seed, all with ``prompt``.
- neither: ``batch_size`` images of ``prompt`` with derived seeds
base..base+batch_size-1 (each masked JSON-safe).
``draw_seed`` supplies a fresh random base when the caller sent none (the
engine passes a ``torch.Generator`` draw). Raises ``ValueError`` on empty /
oversized lists, a length mismatch, or an out-of-range seed."""
if prompts is not None:
if not prompts or not all(isinstance(p, str) and p.strip() for p in prompts):
raise ValueError("prompts must be a non-empty list of non-empty strings")
if len(prompts) > MAX_BATCH_IMAGES:
raise ValueError(f"prompts supports at most {MAX_BATCH_IMAGES} entries per call")
if seeds is not None:
if not seeds:
raise ValueError("seeds must be a non-empty list of integers")
if len(seeds) > MAX_BATCH_IMAGES:
raise ValueError(f"seeds supports at most {MAX_BATCH_IMAGES} entries per call")
seeds = [int(s) for s in seeds]
if any(s < 0 or s > SEED_MASK for s in seeds):
raise ValueError("every seed must be between 0 and 2**53 - 1 (JSON-safe)")
if prompts is not None and len(seeds) != len(prompts):
raise ValueError(
f"prompts and seeds must have the same length "
f"(got {len(prompts)} prompts, {len(seeds)} seeds)"
)
if prompts is not None:
count = len(prompts)
elif seeds is not None:
count = len(seeds)
else:
count = max(1, int(batch_size))
if seeds is not None:
job_seeds = seedsView on GitHub (pinned to 203007d190)
Solutions
- Chunk seeds into groups of at most 32 and make one call per chunk.
- Reduce the sweep size, or use batch_size (for derived sequential seeds) which is bounded the same way.
Example fix
# before
engine.generate(prompt=p, seeds=list(range(1000, 1100)))
# after
for i in range(1000, 1100, 32):
engine.generate(prompt=p, seeds=list(range(i, min(i+32, 1100)))) Defensive patterns
Strategy: validation
Validate before calling
def valid_seed_count(seeds) -> bool:
return seeds is None or len(seeds) <= 32 Try / catch
try:
out = engine.generate(prompt=p, seeds=seeds)
except ValueError as e:
if "seeds supports at most" in str(e):
out = [engine.generate(prompt=p, seeds=c) for c in chunked(seeds, 32)]
else:
raise Prevention
- Chunk seed sweeps into batches of 32.
- Prefer batch_size with derived seeds for sequential runs.
When it happens
Trigger: Calling generate with seeds containing 33+ entries (len(seeds) > 32), typically alongside a single prompt to render variations of it.
Common situations: Seed-sweep scripts enumerating hundreds of seeds to cherry-pick a good render; grid-search tools generating 8x8=64 seeds in one call.
Related errors
- prompts supports at most {MAX_BATCH_IMAGES} entries per call
- seeds must be a non-empty list of integers
- prompts and seeds must have the same length (got {len(prompt
- A prompts list is supported for plain text-to-image only; th
- prompts must be a non-empty list of non-empty strings
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/517e00824d9d0630.
Report an issue: GitHub.