Fix: raise correct error in accelerate mode
Merge pull request #4029 from guersam/patch-1

Fix: raise correct error in accelerate mode