{"record":{"id":"ea0ee4889b033694","repo":"HumanSignal/label-studio","slug":"user-filter-list-exceeds-maximum-size-of-settings","errorCode":null,"errorMessage":"User filter list exceeds maximum size of {settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES}.","messagePattern":"User filter list exceeds maximum size of (.+?)\\.","errorType":"validation","errorClass":"ValidationError","httpStatus":400,"severity":"error","filePath":"label_studio/data_manager/managers.py","lineNumber":649,"sourceCode":"    elif _filter.operator == Operator.EMPTY:\n        if cast_bool_from_str(_filter.value):\n            q = Q(annotations__result__isnull=True) | Q(annotations__result=[])\n        else:\n            q = Q(annotations__result__isnull=False) & ~Q(annotations__result=[])\n        filter_expressions.append(q)\n        return 'continue'\n\n\ndef parse_user_filter_ids(value):\n    \"\"\"Parse a scalar or list user-filter value into deduped integer user ids (FIT-2253).\"\"\"\n    if value is None:\n        return []\n    if (\n        isinstance(value, list)\n        and not isinstance(value, ResolvedUserFilterIds)\n        and len(value) > settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES\n    ):\n        raise ValidationError(\n            f'User filter list exceeds maximum size of {settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES}.'\n        )\n    raw = value if isinstance(value, list) else [value]\n    ids = []\n    seen = set()\n    for item in raw:\n        try:\n            if isinstance(item, bool) or (isinstance(item, float) and not item.is_integer()):\n                raise ValueError\n            user_id = int(item)\n        except (TypeError, ValueError):\n            raise ValidationError('User filter values must be integer ids.') from None\n        if user_id not in seen:\n            seen.add(user_id)\n            ids.append(user_id)\n    return ids\n\n","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/HumanSignal/label-studio/blob/0b49e9b53917880baf1dd85d574fe5541a9aafb2/label_studio/data_manager/managers.py#L631-L667","documentation":"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.","triggerScenarios":"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().","commonSituations":"'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.","solutions":["Split the request into batches under the cap and merge results client-side","Raise settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES if legitimately needed","Use a negated filter (exclude the small complement set) instead of listing thousands of ids","Pre-resolve ids server-side into ResolvedUserFilterIds, which bypasses the raw-list cap"],"exampleFix":"// before\n{\"operator\": \"in_list\", \"value\": ids_for_5000_users}\n// after\nfor chunk in chunks(ids, MAX):  # MAX = settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES\n    apply_filter({\"operator\": \"in_list\", \"value\": chunk})","handlingStrategy":"validation","validationCode":"from django.conf import settings\nif isinstance(value, list) and len(value) > settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES:\n    value = value[:settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES]  # or batch the requests","typeGuard":"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","tryCatchPattern":"try:\n    add_user_filter(...)\nexcept ValidationError as e:\n    if 'exceeds maximum size' in str(e): batch_into_chunks_and_merge(e)\n    else: raise","preventionTips":["Check the cap before serializing 'select all' selections","Prefer negated/exclusion filters over huge positive id lists","Tune settings.DATA_MANAGER_LIST_FILTER_MAX_VALUES consciously per deployment","Paginate id selection in the UI to avoid unbounded arrays"],"tags":["validation","limits","filters","configuration"],"backgroundTag":"filter-list-too-large","analyzedSha":"0b49e9b53917880baf1dd85d574fe5541a9aafb2","analyzedAt":"2026-08-29T00:39:52.578Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}