Baseball can be a confusing game. The 2017 edition of the Official Baseball Rules is 163 pages long and has more cross references than a dictionary. Even the people who spend their lives around the game are often unsure of some of the nuances surrounding the code of rules that govern the game.

Then there are the unwritten rules of baseball. Good luck with those.

Boston Red Sox infielder Eduardo Nunez is trying to figure it all out. In the past two weeks he’s been thrown at and called out for allegedly breaking unwritten rules. Rules that we aren’t sure exist.

On Aug. 23 in Cleveland, Indians ace Corey Kluber hit Nunez with a pitch after Nunez apparently swung too hard at one of Kluber’s pitches. While Kluber denied intentionally throwing at Nunez, there were few on the Red Sox side who thought it was an accident.

Eight days later Nunez was drawing a pitcher’s ire again – this time for not swinging hard enough. He dropped a first-inning bunt on CC Sabathia of the New York Yankees, and Sabathia thought it was a case of Nunez trying to take advantage of the pitcher’s sore knee.

And the pitcher thought that was beneath the standards of a major league hitter.

“It’s just kind of weak to me,” said Sabathia that night. “It shows me what they’ve got over there … they think I’m a bigger guy who can’t field my position, so (they’re) going to try to bunt instead of swinging the bat.”

The Red Sox were having none of it. Jim Rice, my partner on NESN, took to the airwaves that night and said of Sabathia, “What is he talking about? Bunting is part of the game.”

I asked Rice if Sabathia had the right to be upset.

“He has the right to honor his contract, lose some weight, and play his position,” said Rice, who added there is no such rule – written or unwritten – saying a player can’t bunt on a pitcher with a sore knee.

That’s the problem with unwritten rules. If you can’t read the rule, how can you agree on what to do? Nunez was drilled for swinging to hard, then criticized for not taking a full swing.

The bunt in New York was a smart play for a fast runner trying to trigger a first-inning rally. It’s called exploiting a team’s potential weakness. It’s also known as trying to win, which is what ballplayers are paid millions of dollars to do.

A night after the brouhaha Nunez chose not to bunt against Yankees starter Sonny Gray. Instead, he sent a two-run homer to left field. Wonder if Sabathia thought that was better than a bunt?

“It’s a joke,” Nunez told NESN after the game.

It’s no joke that the Red Sox-Yankees rivalry received a little jolt from Buntgate. These two teams have been battling for supremacy in the American League East all summer, but it was a very pleasant little competition with very few heated moments.

One bunt changed all that.

The Red Sox and Yankees are done facing each other this season.

The Sox missed out on a chance to put New York away over the weekend, but the AL East race is still on after the Yankees took 3 of 4 in the Bronx.

There’s a very real chance they could meet again in October. Boston has had trouble with Yankees pitching, and Sabathia would love to get another crack at Nunez and the Sox. If it happens, he’d better be ready for anything, because even he knows there are no unwritten rules in the postseason.

Tom Caron is a studio host for the Red Sox broadcast on NESN. His column appears in the Portland Press Herald on Tuesdays.