This happens when you use the become directive, for instance:

The documentation says two things:

The become_user set to user with desired privileges — the user you become, NOT the user you login as. Does NOT imply become: yes, to allow it to be set at host level. Default value is root.

--become-method=BECOME_METHOD

privilege escalation method to use (default=sudo), valid choices: [ sudo | su | pbrun | pfexec | doas | dzdo | ksu | runas | machinectl ]

SOLUTION: source the .bash_profile in your shell commands