FA-79361 / Barcode symbology encoding / Open access
EAN-13 right half is shifted by one digit · case 01
The seventh digit is encoded twice and the check digit is missing.
ROOT CAUSE
The right half slices code[6:12] instead of the last six digits.
VERIFIED REPAIR
Encode code[7:13] in the right half.
Unsuccessful approach: Starting at index 8 drops a digit and produces a 88-module symbol.
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', 'LGLGLG', 'LGLGGL', '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[6:12])
return '101' + left + '01010' + right + '101'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['3339552094472', '10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101'], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101']], [['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['4006381333931', None], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101']], [['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101'], ['123456789012', None], ['12345678901234', None], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['6191360813603', '10100110010010111011001101000010101111000110101010100100011001101000010101000011100101000010101']], [['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6274612745694', '10100100110010001001110100001010011001001001101010100010010111001001110101000011101001011100101'], ['12345678901234', None], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['6346382380419', '10101111010011101000010101000010110111001001101010100001010010001110010101110011001101110100101']], [['8746102916553', '10101110110011101010111101100110100111001001101010111010011001101010000100111010011101000010101'], ['4502760148617', '10101100010100111001001101110110000101010011101010110011010111001001000101000011001101000100101'], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['3842111701831', '10101101110100011001101101100110110011001100101010100010011100101100110100100010000101100110101']]]
labels = ["regression: right half digit slice", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: right half digit slice 0 | 10101100010000101001011101110110011001001011101010111010010010001000100111010010011101110100101 | 10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101 | Failed |
| repair trap 1 | 10101111010111101001011101110010111001001001101010110110011100101110100101110010111001000100101 | 10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101 | Failed |
| combined fault 2 | None | None | Passed |
| control 3 | None | None | Passed |
| control 4 | None | None | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | None | None | Passed |
| control 7 | 10101100010000101001110101011110110001001000101010100010011101001010000101110010000101000010101 | 10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101 | Failed |
SHA-256 / a0dcedd2d3c612f83f89f0ae9ee5f434753d4b7060dc8b53a259ae98f791217a
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', 'LGLGGL', '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[8:])
return '101' + left + '01010' + right + '101'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['3339552094472', '10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101'], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101']], [['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['4006381333931', None], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101']], [['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101'], ['123456789012', None], ['12345678901234', None], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['6191360813603', '10100110010010111011001101000010101111000110101010100100011001101000010101000011100101000010101']], [['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6274612745694', '10100100110010001001110100001010011001001001101010100010010111001001110101000011101001011100101'], ['12345678901234', None], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['6346382380419', '10101111010011101000010101000010110111001001101010100001010010001110010101110011001101110100101']], [['8746102916553', '10101110110011101010111101100110100111001001101010111010011001101010000100111010011101000010101'], ['4502760148617', '10101100010100111001001101110110000101010011101010110011010111001001000101000011001101000100101'], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['3842111701831', '10101101110100011001101101100110110011001100101010100010011100101100110100100010000101100110101']]]
labels = ["regression: right half digit slice", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: right half digit slice 0 | 1010110001000010100101110111011001100100101110101010001001110100100111011101001011100101 | 10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101 | Failed |
| repair trap 1 | 1010111101011110100101110111001011100100100110101011101001011100101110010001001101100101 | 10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101 | Failed |
| combined fault 2 | None | None | Passed |
| control 3 | None | None | Passed |
| control 4 | None | None | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | None | None | Passed |
| control 7 | 1010110001000010100111010101111011000100100010101010100001011100100001010000101100110101 | 10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101 | Failed |
SHA-256 / cd0c5281b5eba5b926141114dca028ec884e4b60c7f4bd6d5bd2941e350b4d5e
3 / The verified repair
Exit 0"""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', 'LGLGGL', '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 = [[['5569719879594', '10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101'], ['3339552094472', '10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101'], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['5564657964331', '10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101']], [['0777861705172', '10101110110111011011101101101110101111001100101010100010011100101001110110011010001001101100101'], ['4641860725337', '10101011110011101001100101101110000101010011101010100010011011001001110100001010000101000100101'], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['', None], ['4006381333931', None], ['6141838617595', '10100110010011101011001100010010111101011011101010101000011001101000100100111011101001001110101']], [['3716511088176', '10101110110011001000010101110010110011001100101010111001010010001001000110011010001001010000101'], ['7062168881750', '10100011010000101001001101100110101111000100101010100100010010001100110100010010011101110010101'], ['123456789012', None], ['12345678901234', None], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['6191360813603', '10100110010010111011001101000010101111000110101010100100011001101000010101000011100101000010101']], [['1986892142891', '10100010110110111000010101101110010111001101101010110011010111001101100100100011101001100110101'], ['6274612745694', '10100100110010001001110100001010011001001001101010100010010111001001110101000011101001011100101'], ['12345678901234', None], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['6346382380419', '10101111010011101000010101000010110111001001101010100001010010001110010101110011001101110100101']], [['8746102916553', '10101110110011101010111101100110100111001001101010111010011001101010000100111010011101000010101'], ['4502760148617', '10101100010100111001001101110110000101010011101010110011010111001001000101000011001101000100101'], ['', None], ['4006381333931', None], ['12345678901٣2', None], ['123456789012', None], ['12345678901234', None], ['3842111701831', '10101101110100011001101101100110110011001100101010100010011100101100110100100010000101100110101']]]
labels = ["regression: right half digit slice", "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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: right half digit slice 0 | 10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101 | 10101100010000101001011101110110011001001011101010100100010001001110100100111011101001011100101 | Passed |
| repair trap 1 | 10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101 | 10101111010111101001011101110010111001001001101010111001011101001011100101110010001001101100101 | Passed |
| combined fault 2 | None | None | Passed |
| control 3 | None | None | Passed |
| control 4 | None | None | Passed |
| boundary 5 | None | None | Passed |
| boundary 6 | None | None | Passed |
| control 7 | 10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101 | 10101100010000101001110101011110110001001000101010111010010100001011100100001010000101100110101 | Passed |
SHA-256 / 4e1770588b009e2613320b293dc9ebbe273eaddbaf15e4c21c49c9a9b99cc655
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.818926+00:00.
Case digest / 9400b21744b1527397025013be4d3bc00beb7aee0c3a849d062b64d1d2273217