Preheat the oven to 350°F (175°C).
In a large skillet, melt the butter over medium heat.
Add the diced onion and celery to the skillet; sauté until softened (about 5 minutes).
Stir in the chopped sage, salt, and black pepper, cooking for another minute.
Combine the cubed bread with the sautéed mixture in a large bowl.
Pour in the chicken broth gradually, mixing until the bread is moistened but not soggy.
Fold in the cranberries and nuts if using.
Transfer the mixture to a greased baking dish.
Cover the dish with aluminum foil and bake for 25 minutes.
Remove the foil and bake for an additional 15–20 minutes until golden brown.