Preheat Oven: Set to 350°F (175°C) and grease or line an 8x8-inch baking dish with parchment paper.
Mix Dry Ingredients: In a bowl, whisk together flour, baking powder, baking soda, salt, cinnamon, and nutmeg.
Combine Wet Ingredients: In a separate bowl, whisk together sourdough discard, brown sugar, granulated sugar, oil, eggs, and vanilla.
Incorporate Carrots & Nuts: Fold in grated carrots, toasted walnuts, and raisins (if using).
Mix Batter: Gradually add the dry ingredients to the wet mixture, stirring until just combined. Do not overmix.
Bake: Pour the batter into the prepared pan and bake for 22-25 minutes, or until a toothpick inserted in the center comes out clean. Let cool completely.
Make the Frosting: Beat cream cheese, butter, powdered sugar, and vanilla until smooth and creamy.
Frost & Garnish: Spread the frosting over the cooled bars and sprinkle with extra toasted walnuts if desired.
Slice & Enjoy: Cut into squares and serve!