Based on the error message it seems your target tensor contains the class label 255, which is neither being ignored (via ignore_index) nor is a valid class index, as it’s out of bounds.
It seems you want to map the class index 255 to 0 and ignore it and if that’s the case, the mapping seems to fail since values of 255 are still found.