Good day Mr. Farshtey, something I’ve been wondering about for a while, has there ever been any events or instances in which the Toa were forced to ignore the Toa code?
Exemptions are built into the code, and Helryx asked Toa to put it aside for the DW. From BS01:
The Toa Code is a series of guiding principles to which Toa hold themselves. It was developed over time once Toa realized that they needed Matoran’s trust and respect rather than their fear. The code is unwritten but is known by Toa across the universe. Toa who turn evil are stripped of the title of Toa.
The code’s strictest directive is that Toa cannot kill their enemies or purposefully let beings die if it can be prevented. Exceptions to this rule do exist. For example, Toa do not necessarily violate the Toa Code if they kill unintentionally. Likewise, Toa may be excused if they must kill to save themselves or innocents. Even then, Toa who kill are somewhat ostracized. The rule against killing does not appear to extend to Rahi.
Another rule of the Code is that Toa cannot betray their team or the Matoran population. However, an act of redemption and repentance would allow them to earn the title and respect back.
Other aspects of the Code are that Toa are to be honorable and keep their word. Stealing is also heavily frowned upon. In order to maintain the trust of the Matoran, Toa also tend to avoid sneaking around and fighting in secret, so that their good deeds can be seen by the public. These aspects, however, are not universal; Nidhiki and other Toa from the Tren Krom Peninsula are known for striking from the shadows out of necessity.
When Toa Helryx created the Order of Mata Nui, she banned all other Toa from joining, as there were some tasks that the Toa simply could not do, or even know about, and she did not want to put them in a position of compromising the code. Due to her nature as the founder of the Order, she exempted herself from the code, and eventually asked others to do the same for the war with the Brotherhood of Makuta.
Zaria is probably the kind of case you’re looking for:
After the Brotherhood of Makuta rebelled against the Great Spirit, most of Zaria’s fellow Toa of Iron were hunted and killed by the Brotherhood, leaving Zaria one of few to survive the genocide. Zaria was later forced to kill a Makuta during necessary circumstances, violating the Toa Code. The experience haunted him, and also sparked a rumor that he began murdering all of his enemies. - BS01, Zaria
There’s also Lesovikk, but not out of necessity;
Due to his hesitation, which led to his team’s death, Lesovikk blames himself for causing their deaths, and considers himself unworthy to be a Toa. His self-perceived failure to live up to the standards of the Toa exempts him from the Toa Code, and he is willing to kill his opponents. Despite this, he still chose not to kill Karzahni, despite having had two chances to do so. - BS01, Lesovikk