The downside to any code of honor is what happens when you step out of bounds, even if it was unintentional. Samurai had to invent the practice of seppuku (ritual suicide via cutting your own guts out) to account for fuck ups in the day to day life of being an aristocratic, ass kicking machine.
Warriors could not be shamed by falling into enemy hands, so any time a battle went awry and a warrior was going to be taken captive, the answer was to spill his own intestines. If the warrior had the time to perform the full ritual, he would bathe, dress in white robes, eat a meal then pull out a knife and slice his guts open from left to right. If he was in a hurry, like on the battlefield, he'd have to settle for a Snickers or whatever was handy, then gut himself on the spot.
Seppuku wasn't just a means of escaping capture, it was also a punishment for pretty much any major infraction committed by a samurai, and was used to redeem lost honor. In the 1860s, French sailors entered a Japanese town unannounced and caused a ruckus as Frenchmen are wont to do. Samurai warriors came to escort them out, but a fight broke out and the sailors were all killed. This pissed off the French who demanded something be done about it. Then, in a move they totally didn't expect, the men responsible committed seppuku, which freaked the French representative out so badly he requested the ritual be stopped and the remaining men spared.
"I cannot fall into the hands of an enemy, so I— (stabs himself) — fulfill a samurai's... final duty!"
— Ryoma, Fire Emblem Fates (Conquest)