Word for "example of what not to do"

Solution 1:

An example of what not to do is called "a bad example" or a "cautionary tale." Lecturers on morality and other scolds worry that the bad example will not teach the object lesson of what not to do, but rather will encourage imitation. From one such scold, William Dodd, in his 1792 Sermons to Young Men

[I]t is unquestionable that] ... that bad company and bad example will for the most part be sufficient to corrupt.

Solution 2:

A rare but appropriate term is nonexemplar, as an antonym to "exemplar" (in the sense of 'an example to be followed'). The related word nonexample is sometimes used in the same way, but can also be used like "counterexample" as 'an example outside the rule'.