In a group channel, codes correcting and detecting arbitrary patterns of errors (not necessarily “white noise”) are described metrically. This yields sphere-packing and Gilbert bounds on the sizes of all and of maximal codes, respectively. The loop transversal approach builds linear codes correcting arbitrary error patterns. In the binary case, the greedy loop transversal algorithm builds lexicodes.