:salam:
Please see the following fatwa:
Accidental Mistake - IslamQA
Question: As-salam Alaykum, If someone accidentally consumed alcohol through ignorance such as eating Dijon mustard without knowing it was made with alcohol, do the 40 days apply to them as well? Would it be impermissible for someone to pray behind them?
Answer: Wa ‘alaykum assalam wa rahmatullah wa barakatuh.
I pray you are well.
No, it wouldn’t apply to them; the wording of the hadith about their prayer not being accepted seems to imply that it is referring to a deliberate act.
It would also be permissible for someone to pray behind them; the books of fiqh do not mention not having consumed wine for forty days as a condition of being an imam. (Shurunbulali, Maraqi al Falah).
Mistakes Are Overlooked
The Messenger of Allah, Allah bless him and give him peace, said, “Allah has overlooked for my umma mistakes, forgetfulness, and what they are coerced to do.” (Ibn Majah)
In any case, the hadith about the prayer not being accepted for only applies to someone who does not repent from that deed. The Messenger of Allah, Allah bless him and grant him peace, said, “Whoever drinks wine none of his prayers will be accepted for forty days. If he repents Allah will accept his repentance…” (Tirmidhi).
Also, it’s worth noting that not all types of Dijon mustard have wine in it. Some have vinegar as an ingredient, which is permissible.
May Allah grant you the best of both worlds.
[Shaykh] Abdul-Rahim Reasat
Checked and Approved by Shaykh Faraz Rabbani