mudler/LocalAI · error · ValueError

{name} must be at most {maximum}

Error message

{name} must be at most {maximum}

What it means

Raised by require_int() in longcat-video when the parsed integer exceeds the maximum bound the option declares. The value is a valid integer but outside the supported upper range for that parameter.

Source

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


def require_bool(value, name):
    if isinstance(value, bool):
        return value
    if isinstance(value, str) and value.lower() in {"true", "false"}:
        return value.lower() == "true"
    raise ValueError(f"{name} must be true or false")


def require_int(value, name, minimum=None, maximum=None):
    try:
        parsed = int(value)
    except (TypeError, ValueError) as err:
        raise ValueError(f"{name} must be an integer") from err
    if minimum is not None and parsed < minimum:
        raise ValueError(f"{name} must be at least {minimum}")
    if maximum is not None and parsed > maximum:
        raise ValueError(f"{name} must be at most {maximum}")
    return parsed


def require_float(value, name, minimum=None, maximum=None):
    try:
        parsed = float(value)
    except (TypeError, ValueError) as err:
        raise ValueError(f"{name} must be a number") from err
    if minimum is not None and parsed < minimum:
        raise ValueError(f"{name} must be at least {minimum}")
    if maximum is not None and parsed > maximum:
        raise ValueError(f"{name} must be at most {maximum}")
    return parsed


def attention_overrides(name):
    try:
        return dict(ATTENTION_OVERRIDES[name])

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Lower the value to within the documented maximum
  2. If the hardware/model genuinely supports more, raise the maximum at the call site that enforces it
  3. Split the request into multiple smaller requests when the cap is a hard model limit

Example fix

# before
frames = require_int(400, 'num_frames', maximum=201)  # ValueError

# after
frames = require_int(201, 'num_frames', maximum=201)
Defensive patterns

Strategy: validation

Validate before calling

MAX = 201
raw = min(int(request.num_frames), MAX)  # clamp, or reject
frames = require_int(raw, 'num_frames', maximum=MAX)

Type guard

def is_at_most(v, maximum: int) -> bool:
    try:
        return int(v) <= maximum
    except (TypeError, ValueError):
        return False

Try / catch

try:
    frames = require_int(raw, 'num_frames', maximum=201)
except ValueError as err:
    return error_response(str(err), hint=f'num_frames must be <= 201, got {raw!r}')

Prevention

When it happens

Trigger: Calling require_int(value, name, maximum=N) with a parsed value above N, e.g. require_int(9999, 'num_frames', maximum=201) or duration-derived frame counts exceeding the cap.

Common situations: Requesting longer videos or higher frame counts than the model supports, or computing segments from a duration that balloons past the limit.

Related errors


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