Hard red winter wheat is harvested with a combine harvester in Kansas. (Daniel Acker/Bloomberg News)

Republicans aiming to use an upcoming spending bill to fix a glaring problem with their recently passed tax overhaul are running into a wall with Democrats, who were shut out of the tax law process and now don’t want to cooperate unless they get something in return.

Shortly after the rushed passage of last year’s $1.5 trillion tax law, agricultural companies warned that their livelihoods were imperiled after language in the legislation gave a major advantage to their competitors — farming cooperatives — in the heart of America’s agriculture economy. Republicans professed surprise and promised to fix the problem as soon as possible.

“It has to get fixed,” said Rep. K. Michael Conaway (R-Tex.), chairman of the House Agriculture Committee. “I mean, it’s essential.”

But Democrats aren’t willing to go along so easily. They say they warned Republicans that pushing through the law in a matter of weeks — without public hearings — would result in problems and unintended consequences. And now that such issues are emerging, some Democrats resent being asked to lend their votes to a solution.

“They were forewarned that issues of this magnitude, including the co-op issue, could’ve been fully vetted. And now they want us to help them correct what they assured us did not need correction,” said Rep. Richard E. Neal (Mass.), the top Democrat on the tax-writing Ways and Means Committee. “You cannot rewrite the revenue system of the country in five weeks without any hearings, without any witnesses, and not expect the glitches that we’re now beginning to see.”

The dispute carries echoes of the partisan grudge match that followed passage of the Affordable Care Act, when fuming Republicans refused to entertain fixes to the health law, focusing instead on numerous failed efforts to repeal it. The ACA process was much lengthier and more transparent than the writing of the tax bill, but both pieces of legislation ended up passing along party lines.

Republicans now want to fix the tax law as both sides seek the political upper hand in this year’s midterm campaigns. Democrats are celebrating an apparent victory in a Pennsylvania special election this week in a GOP district, where Republicans pulled back ads focused on the bill in the waning days of the election.

Although Republicans continue to argue that the law is a political winner for them, some Democrats took the outcome in Pennsylvania as evidence that the GOP tax message doesn’t work, buoying their own opposition to the law.

Democrats are arguing that the law disproportionately helped the wealthy over middle-class Americans, and that corporations are pouring gains into stock buybacks rather than wage increases for workers.

Against that backdrop, GOP efforts to engineer a fix to what’s being called the “grain glitch” in the tax law take on a political dimension that empowers Democrats to play hardball.

Democratic votes are needed on the government-wide spending bill that must pass by March 23 at midnight to stave off a third federal shutdown this year. In exchange for including a fix to the grain glitch in the omnibus spending bill, Senate Democrats are pushing for inclusion of a tax provision of their own, an affordable-housing tax measure championed by Sen. Maria Cantwell (D-Wash.).

Some Republicans are resistant to adding the Cantwell provision, and the dispute is among a number of unsettled issues that will have to be resolved by top House and Senate leaders of both parties in coming days, before the omnibus legislation is released, which could happen Monday.

The spending bill is one of the few must-pass pieces of legislation Congress will consider this year, making it the favored vehicle for any number of unrelated issues to hitch a ride, from health care and immigration to a disputed transportation project to serve New York City that’s opposed by President Trump.

Earlier this week, Senate Republicans announced an agreement backed by industry groups on a fix to the grain glitch.

The law, as written, allows farmers to deduct 20 percent of their gross sales from their taxes if they sell to farming cooperatives, thanks to wording added to the legislation in final days by several senators from rural states. But if farmers sell to corporations, they can only deduct 20 percent of their net income.

This creates a great incentive to sell to cooperatives, according to analysts, disadvantaging corporations. The solution proposed by Republicans and industry groups modifies the language to eliminate the unintended benefit for co-op sales.

There are numerous farmer-owned cooperatives around the country that run the gamut in size, with the largest operating not much differently from corporations.

House Minority Leader Nancy Pelosi (D-Calif.) is balking at simply including the proposed GOP fix in the omnibus. She told reporters Thursday the GOP solution “favors the biggies” over smaller players in the debate. Pelosi’s spokesman, Drew Hammill, later said the concern is that “the stakeholder groups who negotiated the fix may not have represented all of the interests impacted by the change to the co-op language.”

The dispute has also put some Senate Democrats who represent farm states in an awkward position. Lawmakers such as Sen. Heidi Heitkamp (D-N.D.), who is up for reelection in November, want to help affected constituents but face the dilemma of being called on to rectify a problem they had no role in creating. Heitkamp and others are involved in negotiations on the issue but haven’t yet signed on to the GOP-industry deal.

The grain glitch is the most prominent of a number of issues, many of them intricate and highly technical, that have arisen since the tax law came into effect this year. Among the others: A seeming typo that impacted the effective date for claiming net operating losses, and apparent omission of certain properties in a bonus depreciation provision.

Nonetheless, tax experts say that for a piece of legislation of such breadth, the number of issues that has arisen is not unusual.

“Given the order of magnitude of the changes being implemented, what we’re seeing right now is roughly what I would have expected,” said Rohit Kumar, a former top tax aide to Senate Majority Leader Mitch McConnell (R-Ky.) who is now leader of the tax policy services practice at PwC.

“There is a lot of pressure to get this fixed,” Kumar said of the grain glitch. “I’m hearing from all sorts of clients, even in places I wouldn’t have expected, that this is a problem.”