Preheat the oven to 350°F. Lightly grease a 9x13-inch metal baking pan, or line with parchment paper, leaving overhang on the sides for easy removal.
Grate the zucchini using the large holes of a box grater. Do not blot or squeeze dry unless it is extremely watery.
In a large bowl, whisk together the granulated sugar, brown sugar, oil, eggs, sourdough discard, sour cream, and vanilla until smooth and fully combined.
Add the cocoa powder (and black cocoa powder, if using) to the wet ingredients and whisk until smooth. Let the mixture sit for 1–2 minutes to allow the cocoa to hydrate.
In a separate bowl, whisk together the flour, baking soda, baking powder, salt, and espresso powder.
Add the dry ingredients to the wet ingredients and gently fold until just combined and no dry streaks remain.
Fold in the grated zucchini and chocolate chips until evenly distributed. The batter will be thick.
Pour the batter into the prepared pan and spread evenly.
Bake for 27–32 minutes, or until a toothpick inserted into the center comes out with moist crumbs and the internal temperature reaches about 198–200°F.
Allow the cake to cool completely in the pan or transfer to a board. Cover and let rest for several hours or overnight for best texture.
To make the frosting, beat the softened butter and cocoa powder together until smooth.
Add the powdered sugar, vanilla, salt, and 2 tablespoons of heavy cream. Beat until smooth and creamy, adding more cream as needed until soft and spreadable.
Spread the frosting over the cooled cake using an offset spatula, creating soft swoops.