Using ignore_errors is a bad practice IMHO.
If you get no hits you "|list" will be empty and you "|first" filter
will fail so you need to run it through default filter.
{{
(userinfo.json.users|selectattr('username','match',MYVAR)|list|first|default([])).user_id
}}"
But this will also fail since user_id doesn't exist in a empty list do
you need to run that through the default filter as well.
So this should work without ignore_errors
{{
(userinfo.json.users|selectattr('username','match',MYVAR)|list|first|default([])).user_id
| default('') }}"
--
Kai Stian Olstad