FAILURE MAP
← Case archive

FA-79346 / Barcode symbology encoding / Open access

EAN-13 parity rows for leading digits 7 and 8 are exchanged · case 01

Codes starting with 7 decode as starting with 8 and vice versa, silently changing the country prefix.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The parity table lists the rows for 7 and 8 in swapped order.

THE FAILURE

The parity table lists the rows for 7 and 8 in swapped order.

Unsuccessful approach: Duplicating the 7 row makes 8-prefixed codes decode as 7.

Case contract

Encode a 13-character string of ASCII digits (the check digit is taken as given, not verified) as the 95-module EAN-13 pattern: start guard 101, six left digits in L or G sets chosen by the parity row of the leading digit, centre guard 01010, six right digits in the R set, end guard 101. R is the bitwise complement of L and G is R reversed. Anything else returns None.

Why this case matters

Retail, logistics, pharmacy and document workflows depend on encoders that produce exactly the module pattern, code-set switches, separators and quiet zones scanners expect; one misplaced module or separator makes a label unreadable or, worse, scan as different data.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code):
    if len(code) != 13 or not all(ch in '0123456789' for ch in code):
        return None
    L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']
    R = [''.join('1' if b == '0' else '0' for b in p) for p in L]
    G = [p[::-1] for p in R]
    parity = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGGL', 'LGLGLG', 'LGGLGL']
    pat = parity[int(code[0])]
    left = ''.join((L if pat[i] == 'L' else G)[int(code[1 + i])] for i in range(6))
    right = ''.join(R[int(ch)] for ch in code[7:])
    return '101' + left + '01010' + right + '101'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['8708854500750', '10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101'], ['8966493447779', '10100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101'], ['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101'], ['3339552094472', '10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101'], ['2923603435282', '10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101'], ['3510413208309', '10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101'], ['8535822111223', '10101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101']], [['8021320736862', '10100011010011011001100101000010011011000110101010100010010000101010000100100010100001101100101'], ['8355706274976', '10101111010111001011000100100010100111010111101010110110010001001011100111010010001001010000101'], ['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101'], ['3766842531699', '10101110110101111000010100010010011101001001101010100111010000101100110101000011101001110100101'], ['5117058572420', '10100110010110011001000100011010110001000100101010100111010001001101100101110011011001110010101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['7358317090517', '10101111010111001011011101000010011001001000101010111001011101001110010100111011001101000100101']], [['7867470575448', '10101101110000101011101100111010111011010011101010100111010001001001110101110010111001001000101'], ['8763496138721', '10101110110000101011110100111010010111010111101010110011010000101001000100010011011001100110101'], ['8457347577022', '10101000110111001011101101000010011101011101101010100111010001001000100111001011011001101100101'], ['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['5108124299029', '10100110010100111000100100110010010011001110101010110110011101001110100111001011011001110100101'], ['4275982832382', '10100100110010001011000100010110001001001101101010100100010000101101100100001010010001101100101'], ['1841559138266', '10101101110100011011001101100010111001001011101010110011010000101001000110110010100001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101']], [['8352800374001', '10101111010111001001001100010010100111000110101010100001010001001011100111001011100101100110101'], ['8557236078630', '10101100010111001011101100110110100001010111101010111001010001001001000101000010000101110010101'], ['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6087726577121', '10100011010001001001000100100010010011010111101010100111010001001000100110011011011001100110101'], ['9139450687171', '10100110010100001001011101000110111001000110101010101000010010001000100110011010001001100110101'], ['9147502050346', '10100110010011101001000101100010100111001001101010111001010011101110010100001010111001010000101'], ['3621226624482', '10101011110010011011001100110110011011010111101010101000011011001011100101110010010001101100101'], ['8651558989874', '10101011110111001001100101110010111001011011101010111010010010001110100100100010001001011100101']], [['7195448424184', '10100110010010111011000100111010100011000100101010101110011011001011100110011010010001011100101'], ['8606108755061', '10101011110100111010111101100110100111011011101010100010010011101001110111001010100001100110101'], ['8930890112346', '10100010110100001000110100010010010111000110101010110011011001101101100100001010111001010000101'], ['9803396505759', '10101101110100111010000101111010010111010111101010100111011100101001110100010010011101110100101'], ['5845180047269', '10101101110011101011100100110010110111010011101010111001010111001000100110110010100001110100101'], ['9648988190302', '10101011110011101000100100010110001001011011101010110011011101001110010100001011100101101100101'], ['2139834231886', '10100110010111101001011100010010111101001110101010110110010000101100110100100010010001010000101'], ['8011609402200', '10100011010110011001100100001010100111000101101010101110011100101101100110110011100101110010101']]]
labels = ["regression: parity rows for leading 7 and 8", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: parity rows for leading 7 and 8 01010111011010011101101110001001011000100111010101010011101110010111001010001001001110111001010110101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101Failed
repair trap 11010001011000010101011110011101000101101000010101010111001011100100010010001001000100111010010110100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101Failed
combined fault 21010110001000010100101110111011001100100101110101010010001000100111010010011101110100101110010110101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101Passed
control 31010110001000010100111010101111011000100100010101011101001010000101110010000101000010110011010110101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101Passed
control 41010111101011110100101110111001011100100100110101011100101110100101110010111001000100110110010110101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101Passed
boundary 51010001011001001101000010000101000110101000010101010111001000010100111011011001001000110110010110100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101Passed
boundary 61010110001001100101001110011101011001101111010101011011001110010100100010000101110010111010010110101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101Passed
control 71010110001010000101100010001001001001100110110101011001101100110110011011011001101100100001010110101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101Failed

SHA-256 / 7896321ef75064a10f82b2521f80b1a9fd081b5f24cd4bff061f96ca22cc37f9

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(code):
    if len(code) != 13 or not all(ch in '0123456789' for ch in code):
        return None
    L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']
    R = [''.join('1' if b == '0' else '0' for b in p) for p in L]
    G = [p[::-1] for p in R]
    parity = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGLG', 'LGGLGL']
    pat = parity[int(code[0])]
    left = ''.join((L if pat[i] == 'L' else G)[int(code[1 + i])] for i in range(6))
    right = ''.join(R[int(ch)] for ch in code[7:])
    return '101' + left + '01010' + right + '101'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['8708854500750', '10101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101'], ['8966493447779', '10100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101'], ['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101'], ['3339552094472', '10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101'], ['2923603435282', '10100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101'], ['3510413208309', '10101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101'], ['8535822111223', '10101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101']], [['8021320736862', '10100011010011011001100101000010011011000110101010100010010000101010000100100010100001101100101'], ['8355706274976', '10101111010111001011000100100010100111010111101010110110010001001011100111010010001001010000101'], ['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101'], ['3766842531699', '10101110110101111000010100010010011101001001101010100111010000101100110101000011101001110100101'], ['5117058572420', '10100110010110011001000100011010110001000100101010100111010001001101100101110011011001110010101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['7358317090517', '10101111010111001011011101000010011001001000101010111001011101001110010100111011001101000100101']], [['7867470575448', '10101101110000101011101100111010111011010011101010100111010001001001110101110010111001001000101'], ['8763496138721', '10101110110000101011110100111010010111010111101010110011010000101001000100010011011001100110101'], ['8457347577022', '10101000110111001011101101000010011101011101101010100111010001001000100111001011011001101100101'], ['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['5108124299029', '10100110010100111000100100110010010011001110101010110110011101001110100111001011011001110100101'], ['4275982832382', '10100100110010001011000100010110001001001101101010100100010000101101100100001010010001101100101'], ['1841559138266', '10101101110100011011001101100010111001001011101010110011010000101001000110110010100001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101']], [['8352800374001', '10101111010111001001001100010010100111000110101010100001010001001011100111001011100101100110101'], ['8557236078630', '10101100010111001011101100110110100001010111101010111001010001001001000101000010000101110010101'], ['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6087726577121', '10100011010001001001000100100010010011010111101010100111010001001000100110011011011001100110101'], ['9139450687171', '10100110010100001001011101000110111001000110101010101000010010001000100110011010001001100110101'], ['9147502050346', '10100110010011101001000101100010100111001001101010111001010011101110010100001010111001010000101'], ['3621226624482', '10101011110010011011001100110110011011010111101010101000011011001011100101110010010001101100101'], ['8651558989874', '10101011110111001001100101110010111001011011101010111010010010001110100100100010001001011100101']], [['7195448424184', '10100110010010111011000100111010100011000100101010101110011011001011100110011010010001011100101'], ['8606108755061', '10101011110100111010111101100110100111011011101010100010010011101001110111001010100001100110101'], ['8930890112346', '10100010110100001000110100010010010111000110101010110011011001101101100100001010111001010000101'], ['9803396505759', '10101101110100111010000101111010010111010111101010100111011100101001110100010010011101110100101'], ['5845180047269', '10101101110011101011100100110010110111010011101010111001010111001000100110110010100001110100101'], ['9648988190302', '10101011110011101000100100010110001001011011101010110011011101001110010100001011100101101100101'], ['2139834231886', '10100110010111101001011100010010111101001110101010110110010000101100110100100010010001010000101'], ['8011609402200', '10100011010110011001100100001010100111000101101010101110011100101101100110110011100101110010101']]]
labels = ["regression: parity rows for leading 7 and 8", "repair trap", "combined fault", "control", "control", "boundary", "boundary", "control"]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (labels[i % len(labels)], i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression: parity rows for leading 7 and 8 01010111011010011101101110001001011000100111010101010011101110010111001010001001001110111001010110101110110100111011011100010010111001010001101010100111011100101110010100010010011101110010101Failed
repair trap 11010001011000010101011110011101000101101000010101010111001011100100010010001001000100111010010110100010110000101010111100111010010111011110101010101110010111001000100100010010001001110100101Failed
combined fault 21010110001000010100101110111011001100100101110101010010001000100111010010011101110100101110010110101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101Passed
control 31010110001000010100111010101111011000100100010101011101001010000101110010000101000010110011010110101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101Passed
control 41010111101011110100101110111001011100100100110101011100101110100101110010111001000100110110010110101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101Passed
boundary 51010001011001001101000010000101000110101000010101010111001000010100111011011001001000110110010110100010110010011010000100001010001101010000101010101110010000101001110110110010010001101100101Passed
boundary 61010110001001100101001110011101011001101111010101011011001110010100100010000101110010111010010110101100010011001010011100111010110011011110101010110110011100101001000100001011100101110100101Passed
control 71010110001010000101100010001001001001100110110101011001101100110110011011011001101100100001010110101100010100001011000100010010011011001001101010110011011001101100110110110011011001000010101Failed

SHA-256 / f750d5812b8555e0c83d8f4955dd227e88c551f93ca8377f28e0a6ed5e503f7e

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model with a stipulated contract; it makes no claim of conformance to any published specification. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:49:43.758492+00:00.

Case digest / d5239778c9fef114a34e552e434d298ac24f08434a4f93a1a89a308864ea97ea