I would assume what is happening is that the item is clicked in NEI, then InvTweaks trys to sort it because it thinks the item is being spawned in, but then throws an error because there is no item. I would recommend just switching off sort on pickup until it is fixed