It’s the most wonderful time of the year… until you get a headache from drinking red wine.

A new study explored why people get red wine headaches (yes, it’s a thing). Red wine headaches can happen about 30 minutes after you start sipping but they can also pop up within three hours of having a drink.

Researchers from the University of California, Davis, evaluated why red wine, specifically, can leave you reaching for a Tylenol (or a quiet room).

The team believes that quercetin, a flavanol found naturally in red wines, can interrupt how your body metabolizes alcohol, causing your head to throb. Odd, right? Quercetin is an antioxidant commonly found in fruits and veggies. Some people take it as a supplement. But when it metabolizes with alcohol, it’s not as positive, the researchers say.

“When it gets in your bloodstream, your body converts it to a different form called quercetin glucuronide,” says Andrew Waterhouse, PhD, an author and professor emeritus with the UC Davis Department of Viticulture and Enology. “In that form, it blocks the metabolism of alcohol.”

As a result, the acetaldehyde builds up in your body, explains lead author Apramita Devi, a postdoctoral researcher with the UC Davis Department of Viticulture and Enology.

“Acetaldehyde is a well-known toxin, irritant and inflammatory substance,” Devi says. “Researchers know that high levels of acetaldehyde can cause facial flushing, headache and nausea.”

Disulfiram, a medication prescribed to alcoholics to prevent them from drinking, works similarly causing the toxin to build in your body.  

The study was published in the journal Scientific Reports.

You might only get a red wine headache with certain red varietals. “Quercetin is produced by the grapes in response to sunlight,” Waterhouse said. “If you grow grapes with the clusters exposed, such as they do in the Napa Valley for their cabernets, you get much higher levels of quercetin. In some cases, it can be four to five times higher.”

Red wine could be especially hard on you if you’re of East Asian descent, as about 40% of that population has an enzyme that causes acetaldehyde buildup in their systems.

“We postulate that when susceptible people consume wine with even modest amounts of quercetin, they develop headaches, particularly if they have a preexisting migraine or another primary headache condition,” says Morris Levin, MD, a professor of neurology and director of the Headache Center at the University of California, San Francisco, who is also an author. “We think we are finally on the right track toward explaining this millennia-old mystery. The next step is to test it scientifically on people who develop these headaches, so stay tuned.”

Next up, scientists will compare red wines that contain a lot of quercetin with those that have very little to test their theory about red wine headaches on people. UCSF is heading up the small human clinical trial, funded by the Wine Spectator Scholarship Foundation.