Deleting Users in rails console

Hi, no one has a solution? It seems to happen only when trying to delete some accounts but not others, and I can’t figure out why.

Exemple of my loop running:

2821 : Gurpreet
2969 : GUY26
3012 : dboy3587
3015 : devilsports
3020 : jimyyyy
3029 : vdubgrub
3071 : Frank1
3126 : volgano
3172 : dawei
3307 : almolatham
3320 : embsoft
3352 : auto
3379 : sulemaninc
3447 : Baton
3463 : galvin
3465 : autopartchina
3497 : tracker
Discourse::InvalidAccess: can_delete_user? failed
from /var/www/discourse/lib/guardian/ensure_magic.rb:11:in `method_missing'

All users have been deleted, but not the last one. If I skip this one, it will delete next users until it can’t delete another user for an unidentified reason.

edit: I had to edit these settings:
delete all post max
delete_user_max_post_age
:+1:t6: