mudler/LocalAI · error · ValueError

{name} must be at least {minimum}

Error message

{name} must be at least {minimum}

What it means

Raised by require_int() in longcat-video when the parsed integer is below the minimum bound supplied by the caller. It is a range check on an already-valid integer, so the value parsed fine but the option's contract (e.g. fps >= 1) rejects it.

Source

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

    kept = {key: value for key, value in options.items() if key in known}
    return kept, ignored


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):

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Raise the value to at least the documented minimum
  2. If lower values are genuinely valid, fix the minimum passed by the calling option, not this helper
  3. Clamp before validating when the API promises best-effort semantics: max(value, minimum)

Example fix

# before
fps = require_int(request.fps, 'fps', minimum=1)  # fps=0 -> ValueError

# after
fps = require_int(max(1, request.fps or 1), 'fps', minimum=1)
Defensive patterns

Strategy: validation

Validate before calling

MIN = 1
raw = request.fps if request.fps is not None else MIN
if int(raw) < MIN:
    raw = MIN  # or reject with a specific message
fps = require_int(raw, 'fps', minimum=MIN)

Type guard

def is_at_least(v, minimum: int) -> bool:
    try:
        return int(v) >= minimum
    except (TypeError, ValueError):
        return False

Try / catch

try:
    fps = require_int(raw, 'fps', minimum=1)
except ValueError as err:
    return error_response(str(err), hint=f'fps must be >= 1, got {raw!r}')

Prevention

When it happens

Trigger: Calling require_int(value, name, minimum=N) with a parsed value below N, e.g. require_int(0, 'fps', minimum=1), or a string like '-5' for an option whose minimum is 0 or higher.

Common situations: Off-by-one config values (fps=0, segments=0), negative values from user input, or defaults computed from subtraction that can go below the floor for short clips.

Related errors


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