nodejs/node · error · FilterArgumentError

Missing parameter for attribute name

Error message

Missing parameter for attribute name

What it means

prepare_select_or_reject backs the selectattr/rejectattr filters. When lookup_attr is true (the *_attr variants), args[2] must be the attribute name to test against. If it is missing the LookupError is converted to FilterArgumentError('Missing parameter for attribute name').

Source

Thrown at tools/inspector_protocol/jinja2/filters.py:1110

        try:
            name = args[2]
            args = args[3:]
        except LookupError:
            raise FilterArgumentError('map requires a filter argument')
        func = lambda item: context.environment.call_filter(
            name, item, args, kwargs, context=context)

    return seq, func


def prepare_select_or_reject(args, kwargs, modfunc, lookup_attr):
    context = args[0]
    seq = args[1]
    if lookup_attr:
        try:
            attr = args[2]
        except LookupError:
            raise FilterArgumentError('Missing parameter for attribute name')
        transfunc = make_attrgetter(context.environment, attr)
        off = 1
    else:
        off = 0
        transfunc = lambda x: x

    try:
        name = args[2 + off]
        args = args[3 + off:]
        func = lambda item: context.environment.call_test(
            name, item, args, kwargs)
    except LookupError:
        func = bool

    return seq, lambda item: modfunc(func(transfunc(item)))


def select_or_reject(args, kwargs, modfunc, lookup_attr):

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Supply the attribute name: {{ users|selectattr('is_active') }}.
  2. Optionally follow with a test name and args: {{ users|selectattr('age', 'gt', 18) }}.
  3. If you meant to filter values directly (no attribute), use select/reject instead of selectattr/rejectattr.

Example fix

{# before #}
{{ users|selectattr }}

{# after #}
{{ users|selectattr('is_active') }}
Defensive patterns

Strategy: validation

Validate before calling

def require_attr_name(attr_name):
    if not attr_name:
        raise ValueError('selectattr/rejectattr require an attribute name')
    return attr_name

Type guard

def has_attr_name(attr_name) -> bool:
    return isinstance(attr_name, str) and bool(attr_name)

Try / catch

from jinja2.exceptions import FilterArgumentError
try:
    out = env.call_filter('selectattr', seq, args=(attr, test_name))
except FilterArgumentError:
    out = [x for x in seq if getattr(x, attr, None)]

Prevention

When it happens

Trigger: Calling {{ seq|selectattr }} or {{ seq|rejectattr }} without supplying the attribute name argument.

Common situations: Forgetting the attribute name when using selectattr/rejectattr; confusing them with select/reject (which need no attribute).

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/a4fb781cef6c7f6a. Report an issue: GitHub.