$messenger->addMessage(t('Some rows failed to import, but unable to create directory for error CSV at @csv_directory', $targs), 'error');
we cannot use $targs here because it's not in the scope. @csv_directory is not defined in $targs, we need to use $dir instead
$messenger->addMessage(t("Some rows failed to import, but unable to create directory for error CSV at @csv_directory", ['@csv_directory' => $dir]), 'error');