HumanSignal/label-studio · error · ValidationError

User filter list exceeds maximum size of {settings.DATA_MANA

Error message

User filter list exceeds maximum size of {settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES}.

What it means

parse_user_filter_ids caps the number of values accepted in a user filter at settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES. A list value exceeding that cap (and not already a ResolvedUserFilterIds) raises ValidationError to prevent unbounded IN-clause queries.

Source

Thrown at label_studio/data_manager/managers.py:649

    elif _filter.operator == Operator.EMPTY:
        if cast_bool_from_str(_filter.value):
            q = Q(annotations__result__isnull=True) | Q(annotations__result=[])
        else:
            q = Q(annotations__result__isnull=False) & ~Q(annotations__result=[])
        filter_expressions.append(q)
        return 'continue'


def parse_user_filter_ids(value):
    """Parse a scalar or list user-filter value into deduped integer user ids (FIT-2253)."""
    if value is None:
        return []
    if (
        isinstance(value, list)
        and not isinstance(value, ResolvedUserFilterIds)
        and len(value) > settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES
    ):
        raise ValidationError(
            f'User filter list exceeds maximum size of {settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES}.'
        )
    raw = value if isinstance(value, list) else [value]
    ids = []
    seen = set()
    for item in raw:
        try:
            if isinstance(item, bool) or (isinstance(item, float) and not item.is_integer()):
                raise ValueError
            user_id = int(item)
        except (TypeError, ValueError):
            raise ValidationError('User filter values must be integer ids.') from None
        if user_id not in seen:
            seen.add(user_id)
            ids.append(user_id)
    return ids

View on GitHub (pinned to 0b49e9b539)

Solutions

  1. Split the request into batches under the cap and merge results client-side
  2. Raise settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES if legitimately needed
  3. Use a negated filter (exclude the small complement set) instead of listing thousands of ids
  4. Pre-resolve ids server-side into ResolvedUserFilterIds, which bypasses the raw-list cap

Example fix

// before
{"operator": "in_list", "value": ids_for_5000_users}
// after
for chunk in chunks(ids, MAX):  # MAX = settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES
    apply_filter({"operator": "in_list", "value": chunk})
Defensive patterns

Strategy: validation

Validate before calling

from django.conf import settings
if isinstance(value, list) and len(value) > settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES:
    value = value[:settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES]  # or batch the requests

Type guard

def within_list_cap(value): from django.conf import settings; return not isinstance(value, list) or len(value) <= settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES

Try / catch

try:
    add_user_filter(...)
except ValidationError as e:
    if 'exceeds maximum size' in str(e): batch_into_chunks_and_merge(e)
    else: raise

Prevention

When it happens

Trigger: Submitting a user filter (created_by, annotation/counter ids, etc.) whose list has more entries than the configured maximum via add_user_filter or validate().

Common situations: 'Select all users/ids' style UIs serializing thousands of ids; bulk scripts dumping whole id sets into a filter; deployments that lowered DATA_MANAGER_LIST_FILTER_MAX_VALUES below what saved views contain.

Related errors


AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29). Data as JSON: /api/errors/ea0ee4889b033694. Report an issue: GitHub.