Ibn 'Abbas (May Allah be pleased with them) said: The Messenger of Allah ﷺ said, "If anyone constantly seeks pardon (from Allah), Allah will appoint for him a way out of every distress and a relief from every anxiety, and will provide sustenance for him from where he expects not." in Riyad as-Salihin (1872)
The hadith was compiled by the imams Ahmad (in his Musnad), abu Dawod (in his Sunan) and ibn Majah (in his Sunan) (among the 9 most known books of sunni hadith scholars) and also by al-Hakim from Nishapur (in his al-Mustadrak) and therefore it appears also in his student al-Bayhaqi's as-Sunan al-Kubra.
Note that: most of the following content already is mentioned in fatwa islamqa #119743, but I preferred to quote from the sources as much as possible.
Chain of transmission and qualification
Except with a small deviation in Sunan ibn Majah and al-Hakim (which means that their sanad is higher than that of abu Dawod) all of these scholars narrated it via the following chain of transmission:
... -> Al-Walid ibn Muslim الوليد بن مسلم
-> Al-Hakam ibn Mus'ab الحكم بن مصعب
-> Muhammad ibn 'Ali ibn 'Abdullah ibn 'Abbas محمد بن علي بن عبد الله بن عباس
-> (His father) 'Ali ibn 'Abdullah ibn 'Abbas علي بن عبد الله بن عباس: This narrator was not mentioned by ibn Majah and al-Hakim (al-Bayhaqi)
-> 'Abdullah ibn 'Abbas عبد الله بن عباس
This chain has a weakness: Al-Hakam ibn Mus'ab الحكم بن مصعب:
this narrator is unknown according to a-Dhahabi in his Talkhis (summary with some qualifications of the content an early work of a-Dhahabi in which he didn't qualify all the ahadith of al-Hakim's al-Mustadrak) on al-Mustadrak (however al-Hakim claimed it had a sahih chain of transmission) his statement was added in the above source:
Here and in the following I'll be translating from Arabic language, as these translations are of my own, take them with the necessary care!
هذا حديث صحيح الإسناد ولم يخرجاه - الحكم بن مصعب فيه جهالة
This hadith is a saheeh hadith, and they did not narrate it - Al-Hakam ibn Mus'ab is unknown.
the same view was held by ibn Hajar al-'Asqalani, Al-Mizzi quoted in his Tahdeeb al-Kamal تهذيب الكمال في أسماء الرجال -see here in Arabic- (+information form the examination of the book by Dr. Bashar 'Awaad Ma'aruf) the following about him:
(*) الحكم بن مصعب القرشي المخزومي الدمشقي .
Al-Hakam ibn Mus'ab al-Qurashi(from the tribe Quraish) al-Makhzumi (from the clan of Bani Makhzuum) a-Dimashqi (lived/died at Damascus)
روى عن: محمد بن علي بن عبد الله بن عباس.
Has narrated from: Muahmmad ibn 'Ali ibn 'Abdullah ibn 'Abbas. روى عنه: الوليد بن مسلم.
From him has narrated: al-Walid (or al-Waleed) ibn Muslim.
قال أبو حاتم : هو شيخ للوليد بن مسلم، لا أعلم روى عنه أحد غيره.
Abu Hathim (Ar-Razi) said (about him in his al-Jarh wa at-Ta'adeel): he is a teacher of al-Walid ibn Muslim. I don't know anybody else having narrated from him.
وذكره ابن حبان في كتاب "الثقات"، وقال : يخطئ .
Ibn Hebban quoted him once in his a-Theqaat (the trust worthies) and said: he makes mistakes
(*) د سي ق in al-Mizzi's book refers to narrators which were mentioned in (د) Sunan of abi Dawod, (سي) 'Amal al-Yawm wa al-Laylah of imam an-Nasa-i and (ق) Sunan ibn Majah as one can read here and in the following pages.
In the examination we may also read (Words in Italic are the commentaries of the Dr. Bashar 'Awaad Ma'aruf on earlier quotes of scholars):
وتبارد فذكره في "المجروحين"وقال: روى عنه الوليد بن مسلم وأبو المغيرة، ينفرد بالاشياء التي لا ينكر نفي صحتها من عني بهذا الشأن، لا يحل الاحتجاج به، ولا الرواية عنه، إلا على سبيل الاعتبار"، وهذا تناقض شديد.
He showed coldness and mentioned him in “Al-Majrouhin” and said: Al-Waleed ibn Muslim and abu Al-Mughira narrated from him, and he is (or remains) unique (means he narrates ahadith that none else has transmitted) in the things (narrations) which authenticity is not denied (refuted) by those who dedicates themselves to this matter(hadith-sciences or more precisely 'ilm ar-Rijal). And this is a stark contradiction.
وقال الأزدي: لا يتابع على حديثه، فيه نظر. وقال الذهبي في "الكاشف": صويلح"، ولكنه جهله في المغني، وكذا قال ابن حجر في "التقريب".
Al-Azadi's statement: His hadith is not to be examined (?). Is to be verified.
A-Dhahabi declared him in "al-Kashaaf" as "suwaylih(**)"(see #1190 here- in Arabic) while he didn't know him in his "al-Mughni" (See #1677 here -in Arabic) and the same applies to ibn Hajar in his "at-Taqreeb" (see #1461 here -in Arabic-).
(?): I guess it rather means his hadith shouldn't be taken without examination! But I'm not really familiar with the terminology.
(**) a diminutive of salih: acceptable or OK.
The fact that the examiner of this book found ibn Hebban's statements contradictory can somehow be resolved with the knowledge we have from Is there a scale or classification for scholars and their qualification of hadith narrators?
Al-Mizzi further made clear that at least for ibn Majah this is the only narration he quoted from al-Hakam ibn Mus'ab in his Sunan.
Content of the hadith
The content of the hadith itself however is in clear accordance with the qur'an as Allah says:
And those who, when they commit an immorality or wrong themselves [by transgression], remember Allah and seek forgiveness for their sins - and who can forgive sins except Allah ? - and [who] do not persist in what they have done while they know. (135)
Those - their reward is forgiveness from their Lord and gardens beneath which rivers flow [in Paradise], wherein they will abide eternally; and excellent is the reward of the [righteous] workers. (3:135-136)
And [saying], "Seek forgiveness of your Lord and repent to Him, [and] He will let you enjoy a good provision for a specified term and give every doer of favor his favor. But if you turn away, then indeed, I fear for you the punishment of a great Day. (11:3)
... And whoever fears Allah - He will make for him a way out (2)
And will provide for him from where he does not expect. And whoever relies upon Allah - then He is sufficient for him. Indeed, Allah will accomplish His purpose. Allah has already set for everything a [decreed] extent. (65:2-3)
And said, 'Ask forgiveness of your Lord. Indeed, He is ever a Perpetual Forgiver. ...(71:10 ...)
All these verse show that Istighfar is a good deed which will be recompensed by Allah and is therefore highly recommended. Therefore scholars such as ibn Baz said the meaning of the hadith is fine, but the narrator makes it da'if and we recommend to teach it in a passive voice: not in the form the prophet () said that ..., but it was narrated that ...