StackOverflowError: Pancake stack exceeded maximum depth
Exception in thread "brunch" StackOverflowError: pancake stack depth exceeded (max 9)
at Griddle.flip(griddle.c:22)
at Pancakes.stack(pancakes.c:14)
at Pancakes.stack(pancakes.c:14)
at Pancakes.stack(pancakes.c:14)
... 11 more
at Brunch.serve(brunch.c:3)
Impact
A stack of 14 tipped onto the counter on the way to the table. The top five were recovered under the five-second rule, which is not a real rule.
Root cause
Recursive call with no base case. The cook kept making one more pancake because there was still batter.
Resolution
Pancakes redistributed across three plates in stacks of four or five. Brunch resumed.
Action items
- Add a base case: stop when the batter runs out or the stack reaches five.
- Keep finished pancakes warm on a rack in a 95°C / 200°F oven instead of piling them up. Tall stacks steam themselves soft.
- Rest the batter 10 minutes before cooking. The first pancake is still a test build.
# This is a blameless postmortem. The kitchen is a system. Systems fail. Cooks learn.