mudler/LocalAI · error · ValueError
width and height must not exceed 1280x768
Error message
width and height must not exceed 1280x768
What it means
Raised by validate_dimensions() in longcat-video when width exceeds 1280 or height exceeds 768 on either axis. This is a per-axis ceiling, checked before the combined pixel-budget check.
Source
Thrown at backend/python/longcat-video/longcat_utils.py:194
def avatar_segments_for_frames(frames):
if not frames or frames <= 93:
return 1
return 1 + math.ceil((frames - 93) / 80)
def avatar_segments_for_duration(duration_seconds, fps=25):
if duration_seconds <= 0:
return 1
return avatar_segments_for_frames(math.ceil(duration_seconds * fps))
def validate_dimensions(width, height):
width = width or 832
height = height or 480
if width < 256 or height < 256:
raise ValueError("width and height must each be at least 256")
if width > 1280 or height > 768:
raise ValueError("width and height must not exceed 1280x768")
if width % 16 != 0 or height % 16 != 0:
raise ValueError("width and height must be divisible by 16")
if width * height > 1280 * 768:
raise ValueError("requested video dimensions exceed the 1280x768 pixel limit")
return width, height
View on GitHub (pinned to 44413a9d06)
Solutions
- Cap width at 1280 and height at 768
- Use 1280x720 or 832x480 (the default) which satisfy both axes
- Downscale output after generation if a larger canvas is truly needed
Example fix
# before validate_dimensions(1920, 704) # ValueError: must not exceed 1280x768 # after validate_dimensions(1280, 704)
Defensive patterns
Strategy: validation
Validate before calling
MAX_W, MAX_H = 1280, 768 w = min(request.width or 832, MAX_W) h = min(request.height or 480, MAX_H) validate_dimensions(w, h)
Type guard
def within_axis_caps(w: int, h: int) -> bool:
return (w or 832) <= 1280 and (h or 480) <= 768 Try / catch
try:
w, h = validate_dimensions(w, h)
except ValueError as err:
return error_response(str(err), hint='per-axis cap 1280x768; try 1280x720') Prevention
- Clamp axes to 1280/768 client-side
- Prefer known-good presets (832x480, 1280x720)
- Remember 1080p-height values always fail
When it happens
Trigger: Calling validate_dimensions with width > 1280 (e.g. 1920) or height > 768 (e.g. 1080), even if the other axis is small enough that total pixels would fit.
Common situations: Requesting 1080p/720p-standard resolutions where height 768 is exceeded (1280x720 passes; 1280x800 does not), or reusing image-aspect dimensions for video.
Related errors
- width and height must each be at least 256
- width and height must be divisible by 16
- requested video dimensions exceed the 1280x768 pixel limit
- resolution must be 480p or 720p
- start_image is not a readable staged file
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/69e1b384ff5717ca.
Report an issue: GitHub.