The question is really unusual however we’d attempt to answer the best way we can.
Familiar with the parable of the Good Samaritan?
“A man was going down from Jerusalem to Jericho, when he was attacked by robbers. They stripped him of his clothes, beat him and went away, leaving him half dead. A priest happened to be going down the same road, and when he saw the man, he passed by on the other side. So too, a Levite, when he came to the place and saw him, passed by on the other side. But a Samaritan, as he traveled, came where the man was; and when he saw him, he took pity on him. He went to him and bandaged his wounds, pouring on oil and wine. Then he put the man on his own donkey, brought him to an inn and took care of him. 35 The next day he took out two denarii and gave them to the innkeeper. ‘Look after him,’ he said, ‘and when I return, I will reimburse you for any extra expense you may have.’
“Which of these three do you think was a neighbor to the man who fell into the hands of robbers?”
The expert in the law replied, “The one who had mercy on him.”
Jesus told him, “Go and do likewise.” – Luke 10:30-37
Let us say this priest and the Levite were hurrying to make it to the temple for Sabbath, do you not think it would be tantamount to sin to abandon this dying man and go to the temple?
God is free not a robot
We can never be able to perfectly predict how God thinks or how he sees everything. We can only judge from natural laws, scripture and catechism. And also from the directions of superiors (especially those in religious houses and church hierarchy).
The laws of God does not apply to everyone the very same way because there are very many situations that could alter the way those laws are applied.
For instance, a person who is addicted to drugs and when under the influence commits murder vs someone who goes to kill another person after days of plotting. Which of these two do you think has more malice in their hearts? The man who acts under the influence and without freedom or the man who freely chooses to kill another?
Answering the question:
There is never a religious act that God is tied to as though He cannot but respond to the act. God is a free being and judges the hearts of all who serve him. No matter how vile a person may appear, he could be God’s favorite and vice versa.
Now, If you want to know if it can ever be wrong to attend a Sunday mass, the answer is obviously yes. When one abandons someone in need of help, especially when we have an obligation towards those people, we are no longer following the commandment of love. Let’s say you live with your mother alone, and she’s very ill and cannot take care of herself. Do you know it could be sinful to abandon her by her self because you want to go to mass? We have to be able to consider our immediate situation to understand what God wants from us here and now.
God considers situations, your abilities and limitations. He understands you really wish to be with him at mass. But if you have a sick person or you are sick yourself (and contagious), you MUST stay back.
I think this is the only situation i’d say it could be ‘bad’ to attend mass since we’d be ignoring a lot; and we run even the risk of losing a life. So when the stakes are that high, we should consider saving lives first.
If you can think of other scenarios, add below for the benefit of the inquirer.