Cake4 - Custom validation error message

Hi, I’m a little bit confused about setting a custom error message on model validation fail :


 ->maxLength('username', 30)

 ->requirePresence('username', 'create')


 ->add('username', 'unique', ['rule' => 'validateUnique', 'provider' => 'table', 'message' => 'This Name is already taken']);

But the error message is still “This value is already in use”

do I have to do something else to set a custom error message ?

Check once after clearing orm cache. Also, make sure validateUnique is returning boolean value only.