Is it a sin to miss Mass, if the reason is some mental illness, such as depression, anxiety, obsessive-compulsive disorder, bipolar disorder, etc.? To miss Mass on a Sunday or holy day of obligation, without sin, you only need a just reason, not a grave reason. If you were to miss Mass for a longer period of time, you would need a reason proportionate to the length of time. So it is not a sin to miss Mass, if the reason is that your depression or anxiety or other mental illness or psychological condition is acting up or is making it difficult to get to Mass.
Try to spend time during the day in prayer. Look up the readings for the Mass online and read them prayerfully. Keep holy the Sabbath, even if you cannot get to Mass.
If you regularly go to Mass, and on occasion you miss Mass for little or no reason, that is usually only a venial sin. Attending Mass is a grave obligation, but a substantially limited failure to fulfill a grave obligation is venial, not mortal. Only a substantially full failure to fulfill a grave obligation is mortal.
Example: a husband has a grave obligation of fidelity to his wife. But if he violates that fidelity in a very limited manner, it is a venial sin, not a mortal sin. So if he flirts with the waitress at dinner, that is not a mortal sin. If he sleeps with the waitress, then he has committed a mortal sin.