Heat the oven to 350°F (177°C). Grease two 9-inch round cake pans, line the bottoms with parchment rounds, then grease the parchment. Set the pans aside.
Grate the zucchini on the larger holes of a box grater. Place the shredded zucchini in a clean kitchen towel or several layers of paper towel and press gently to remove excess moisture — you want it damp but not dripping.
In a large bowl whisk together the flour, cocoa powder, baking soda, baking powder, espresso powder (if using), salt, and cinnamon until evenly combined. Set aside.
In the bowl of a stand mixer (or a large bowl with a hand mixer) combine the oil with both sugars. Beat on medium speed until the mixture looks smooth and the sugars are moistened, about 1–2 minutes. Add the eggs one at a time, beating briefly after each addition until incorporated.
Mix in the sour cream and vanilla just until combined. Transfer the zucchini to the batter and fold it in by hand with a spatula so the strands are evenly distributed.
Add the dry ingredients to the wet mixture in two additions, folding gently after each addition until no streaks remain. Stir in the chocolate chips with a spatula. The batter will be thick but scoopable.
Divide the batter evenly between the prepared pans and smooth the tops. Bake in the center of the oven for 30–34 minutes, or until a toothpick inserted near the center comes out with moist crumbs but not wet batter. Rotating the pans once halfway through baking helps them brown evenly.
Remove the cakes from the oven and let them rest in the pans on a wire rack for about 20 minutes. Run a thin knife around the edges, invert the cakes onto the rack, peel off the parchment, and let them cool completely before frosting (at least another 45 minutes).
While the cakes cool, make the buttercream. Beat the softened butter on medium speed until creamy, about 2–3 minutes. Gradually add the confectioners' sugar and cocoa powder with the mixer on low so the dry ingredients don’t billow. Add 3 tablespoons of the cream, the salt, and vanilla; then increase the speed to medium-high and beat until smooth and fluffy, about 1–2 minutes. If the frosting is too stiff add up to 2 more tablespoons cream; if too loose, add a little more powdered sugar.
Trim the domes from the cake layers so they sit flat. Place one layer on your serving plate and spread about a heaping cup of buttercream over it. Top with the second layer, apply a thin crumb coat of frosting to the sides and top, then chill the cake in the fridge for 15–20 minutes to set the crumb coat. Finish frosting the cake smoothly and decorate with extra chocolate chips or sprinkles if you like.
Keep the finished cake covered at room temperature for up to 2 days, or refrigerate for up to 5 days. If refrigerated, let slices come to room temperature for about 20 minutes before serving for the best texture.