fix invalid credentials path. return error if invalid