I'm going to assume that you are talking about an AR platform. If you can't send it back to the manufacturer, the fastest thing to do is purchase another barrel.
I wouldn't be so quick to blame the barrel. There have been some questionable AR bolts over the last few years.
I found out that I have a Bear Creek, .223 Wylde, barrel that has too short of headspace, I was getting ready to put it on a build, but, I used Chad's gauges to check it with 4 different bolts and 2 different uppers and it won't close on any of the gauges. Looks like I will have to send it back to either Primary Arm or to Bear Creek.
Thanks' for the gauges Chad.
About 20% of AR's I have handled have short headspace issues. The people that say they haven't seen headspaxe issues usually don't have gauges or they are following the wrong specs.
Excessive headspace is less common.
20% is not insignificant. Is this primarily on home builds or manufactured rifles? And what do you do when you encounter short headspace issues? Replace barrel seems to be the most common recommendation in this thread.
There are simply too many variables to cover to out in a simple post.
I do have special headspace gauges that check a barrel without a bolt. This helps me determine if the barrel is at fault.
From there, one can try different bolts, oil, lapping, abrasive lapping, or reaming the chamber but there are lots of "gotchas", by oversimplified explanations like this. What I mean is, if headspace is not right, and you are not sure how to fix it, you don't. You seek out a professional or have the components replaced by the manufacturer.