I got the same issue, it looks like unsloth is changing something under the hood. I fix the issue by making sure unsloth is imported BEFORE trl.
from unsloth import FastLanguageModel
from trl import SFTTrainer, SFTConfig
my package version:
trl==0.18.2
unsloth==2025.6.2