About 3km from home, on my evening commute home from work. I actually had all the tools and parts I would have needed to fix the flat that made me walk home, but I figured it was dark and it would have taken me just as long to fix the flat and then ride home as it would to just walk directly, so I walked the bike home and fixed it later. I'm always well prepared when I ride long distances away from home, so I have never been stranded.