The cancellation of the hit series “Roseanne” is going to cost ABC in a big way.

ABC shut the show down following star Roseanne Barr’s racist tweet about former Obama aide Valerie Jarrett. The move puts the network on the hook for a hefty sum of money.

“The network has a right to cancel any show at any time, so they’re exercising their right to cancel the show,” Oliver Herzfeld, Entertainment lawyer and Chief Legal Officer at Beanstalk Group, told Fox News.

But he noted the well-known cast members on the series were not involved in Barr’s tweet, and therefore are due the money they were promised for the already greenlit second season.

“Those other cast and crew who had the strong bargaining power, most likely because they’re well known, they’re going to be entitled to their guaranteed payments in their contract. I mean, they had nothing to do with Roseanne’s tweets.”

Sources told The Hollywood Reporter Sara Gilbert, Laurie Metcalf and John Goodman, who each recently negotiated a $300,000 per episode payment for the second season, will be paid for at least 10 episodes of the now-defunct season 2.

The Hollywood Reporter states the network could be out "tens of millions of dollars."

And the show could also end up paying off Barr if the star decides to take legal action.

According to The Blast, Barr had a morality clause in her contract, which allows an employer to fire an employee if the employee brings negative attention to said employer. But that doesn’t mean Barr can’t try to fight her firing.

Entertainment lawyer Schuyler Moore, who negotiates morality clauses at Greenberg Glusker, believes that litigation on Barr could still end up walking away with some money if she decides to go after the network.

“Her position would no doubt be that her tweet was First Amendment rights and that they can’t control what she does outside work,” he told Fox News. “This wasn’t a sexual harassment claim and that this was just her speaking her mind. That it was not a violation of her morality clause because it requires actions, not speech.”

Moore said that argument may not go too far, but he noted that there’s always room for litigation. And Barr recently told her followers that she’s considering fighting back.

Even if ABC doesn’t end up having to pay Roseanne, Herzfeld said ABC has a serious money problem to deal with.

“This is going to be an enormously expensive thing for the network regardless of what they have to pay to settle with Roseanne and whatever guaranteed minimums they have to pay to the cast and crew that has bargaining power. This was an extremely successful reboot and they’re going to lose all the revenue that they were expecting to receive with this show,” he said. “They’ll have to replace the time slot as well with a show that might not be as successful.”

The only way for ABC to save its wallet may be to bring the show back, sans Barr.

According to the Daily Mail, Metcalf is open to the idea of a spinoff starring her, Goodman and Gilbert. Entertainment Weekly reported that ABC is in discussions to figure out if a spinoff if possible.

ABC did not immediately return Fox News’ request for comment.