mudler/LocalAI · error · ValueError

requested video dimensions exceed the 1280x768 pixel limit

Error message

requested video dimensions exceed the 1280x768 pixel limit

What it means

Raised by validate_dimensions() in longcat-video as the final check when width*height exceeds 1280*768 (983040 pixels total). Both axes individually fit their caps, but the combined resolution exceeds the model's pixel budget — e.g. 1280x768 is allowed yet 1280x768-equivalent tall aspect (768x1280 fails the height check first) so this fires for combos like 1024x1024.

Source

Thrown at backend/python/longcat-video/longcat_utils.py:198


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

  1. Reduce one dimension until width*height <= 983040 (e.g. 1024x960 -> 1024x896)
  2. Use 832x480 or 1280x768 which are known-good
  3. Compute the product before submitting and downscale proportionally

Example fix

# before
validate_dimensions(1024, 1024)  # ValueError: pixel limit

# after
validate_dimensions(1024, 896)   # 917504 <= 983040
Defensive patterns

Strategy: validation

Validate before calling

PIXEL_BUDGET = 1280 * 768
if (w or 832) * (h or 480) > PIXEL_BUDGET:
    scale = (PIXEL_BUDGET / (w * h)) ** 0.5
    w, h = int(w * scale // 16) * 16, int(h * scale // 16) * 16
validate_dimensions(w, h)

Type guard

def within_pixel_budget(w: int, h: int) -> bool:
    return (w or 832) * (h or 480) <= 1280 * 768

Try / catch

try:
    w, h = validate_dimensions(w, h)
except ValueError as err:
    return error_response(str(err), hint='total pixels must be <= 983040')

Prevention

When it happens

Trigger: Calling validate_dimensions with values like 1024x1024 (1048576 > 983040) or 1280x768-borderline products; each axis passes but the product exceeds the limit.

Common situations: Square formats (1024x1024) that fit per-axis but blow the total, or trading width for height while keeping high resolution.

Related errors


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/055dd523a8762d25. Report an issue: GitHub.