B.G 8.05
अन्तकाले च मामेव स्मरन् मुक्त्वा कलेवरम्। यः प्रयाति स मद्भावं याति नास्त्यत्र संशयः ॥५॥
antakāle ca māmeva smaran muktvā kalevaram। yaḥ prayāti sa madbhāvaṁ yāti nāstyatra saṁśayaḥ ॥5॥
Whoever, at the time of death, remembering Me alone, becomes free from this body, attains divine existence in Me. Of this, there is no doubt.
Gīta Tātparya 8.05
Remembering the Lord at the time of death is possible only for those who have mastered the ability to be absorbed in Him all the time through constant remembrance.
My state (madbhāvaṁ) means existence in Me. Only for those who are always absorbed in that state it is possible to depart remembering Me. Therefore, mere remembrance at the final moment is not possible. Even if one tries, he fails, like a fall from meditation, due to memory following past karma. Hence, only attainment according to past karma occurs. For those with direct knowledge, at the end of their operative karma, remembering Me while departing certainly happens. Because it has been said, 'Even at the time of departure, they know Me(7-30).' From the qualifier 'those whose minds are absorbed (7-30),' it follows that direct knowledge arises only for those who remember Me constantly.
"Direct vision of Vishnu arises only through devotion, knowledge, abstaining from prohibited actions, constant remembrance of Hari, detachment, and renouncing the fruits of prescribed actions. It never arises in any other way."
-stated thus is Sattvata samhita (one of the earliest Pancharatra āgamas).