Why is my espresso sour?
Sour espresso is almost always under-extraction: water left the puck before it dissolved enough of the sweet, soluble material. Grind finer first, and if that is not enough, raise your brew temperature and pull a longer ratio.
Coffee extracts in a rough order. Acids and salts come out early, sugars and sweetness in the middle, bitter compounds late. A shot that tastes sharp, thin, salty or like sucking a lemon stopped before the middle of that curve. That is under-extraction, and grind size is the biggest lever you have on it because a finer grind means more surface area and more resistance, which slows the water down and gives it more time to work.
Start with the standard reference point: 18 g in the basket, 36 g of liquid espresso out, in 25 to 30 seconds. If your shot hit 36 g in under 22 seconds, it is running too fast and you have your answer. Go two or three steps finer on the grinder, keep the dose identical, and pull again. Change one variable at a time or you will never know which one fixed it.
If the timing already looks correct and it still tastes sour, temperature is the next suspect. Under-extraction at a normal shot time usually means the water is too cool. Most machines brew around 92 to 93 °C. Light and medium-light roasts are dense and hard to extract, so push toward 94 to 96 °C. Also make sure the machine is genuinely warm: 20 to 30 minutes from cold, and pull a blank flush through the group before the first shot so the portafilter and group head are not stealing heat.
Two more common causes. First, the coffee is too fresh. Espresso from beans roasted two or three days ago is gassy, the puck resists unevenly and the cup reads sour and hollow. Five to fourteen days off roast is the reliable window for espresso. Second, the roast itself: if you are pulling a Nordic-style light roast on a machine without temperature control, sourness may be the machine's ceiling rather than your technique, and a longer ratio like 1:2.5 or 1:3 is the honest fix.
One thing worth saying plainly: sour and bitter can happen in the same shot. If the cup is sharp and harsh at once, you are not under-extracting evenly, you are channeling. Water is racing through one part of the puck and barely touching the rest, so you get both defects together. That is a prep problem, not a grind problem, and grinding finer will make it worse.