Entity infinity-container can't call get_filter but has filter_slot_count > 0, so need to skip get_active_items() if entity == "infinity-container". Confirmed that this fixes the crash:
if entity.filter_slot_count > 0 and entity.type ~= "infinity-container"
Repo: spawn infinity container in editor, place it. Open in non-editor mode.