FAILURE MAP
← Case archive

FA-79806 / Barcode symbology encoding / Open access

First pad codeword is randomised · case 01

Decoders do not recognise the end of data because the first pad is not 129.

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

ROOT CAUSE

Every pad is randomised, including the first one that must be the literal 129.

THE FAILURE

Every pad is randomised, including the first one that must be the literal 129.

Unsuccessful approach: 128 is an ASCII codeword, not the pad value.

Case contract

Data Matrix ASCII encodation into `capacity` data codewords: two consecutive ASCII digits become 130 + their value; ASCII 0..127 becomes ord + 1; 128..255 becomes Upper Shift 235 then ord - 127; higher code points are unencodable. Too many codewords -> overflow. Padding: the first pad is 129; each later pad at 1-based position p is 129 + ((149 * p) mod 253) + 1, minus 254 if above 254.

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(text, capacity):
    cw = []
    i = 0
    while i < len(text):
        c = text[i]
        if c in '0123456789' and i + 1 < len(text) and text[i + 1] in '0123456789':
            cw.append(130 + int(text[i:i + 2]))
            i += 2
            continue
        o = ord(c)
        if o > 255:
            return {'error': 'unencodable'}
        if o > 127:
            cw += [235, o - 127]
        else:
            cw.append(o + 1)
        i += 1
    if len(cw) > capacity:
        return {'error': 'overflow'}
    while len(cw) < capacity:
        p = len(cw) + 1
        v = 129 + ((149 * p) % 253) + 1
        if v > 254:
            v -= 254
        cw.append(v)
    return cw
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('', 6), [129, 175, 70, 220, 115, 11]], [('\x80', 4), [235, 1, 129, 220]], [('0AB12', 3), {'error': 'overflow'}], [('ABé', 1), {'error': 'overflow'}], [('AB€€', 10), {'error': 'unencodable'}], [(' ÿ5', 2), {'error': 'overflow'}], [('é \x80AB', 4), {'error': 'overflow'}], [('99x', 5), [229, 121, 129, 220, 115]]], [[(' ABAB12', 8), [33, 66, 67, 66, 67, 142, 129, 56]], [('x', 4), [121, 129, 70, 220]], [('x€', 10), {'error': 'unencodable'}], [(' 125', 1), {'error': 'overflow'}], [('99€x', 6), {'error': 'unencodable'}], [('ÿ€', 10), {'error': 'unencodable'}], [(' €5', 5), {'error': 'unencodable'}], [(' AB', 4), [33, 66, 67, 129]]], [[('', 4), [129, 175, 70, 220]], [('99é0', 5), [229, 235, 106, 49, 129]], [('éé', 3), {'error': 'overflow'}], [('é\x80\x80', 3), {'error': 'overflow'}], [('€', 6), {'error': 'unencodable'}], [('xAB99', 2), {'error': 'overflow'}], [('12é\x80', 1), {'error': 'overflow'}], [('x99AB', 11), [121, 229, 66, 67, 129, 11, 161, 56, 206, 101, 251]]], [[('0xÿ', 8), [49, 121, 235, 128, 129, 11, 161, 56]], [('99', 3), [229, 129, 70]], [('\x8012x5', 1), {'error': 'overflow'}], [(' €ÿ\x80', 5), {'error': 'unencodable'}], [('AB€x', 2), {'error': 'unencodable'}], [('€ ', 4), {'error': 'unencodable'}], [('€', 2), {'error': 'unencodable'}], [('', 6), [129, 175, 70, 220, 115, 11]]], [[('', 7), [129, 175, 70, 220, 115, 11, 161]], [('xÿ99', 9), [121, 235, 128, 229, 129, 11, 161, 56, 206]], [('\x80€ 0', 8), {'error': 'unencodable'}], [('€99', 7), {'error': 'unencodable'}], [('€\x80', 9), {'error': 'unencodable'}], [('\x80', 1), {'error': 'overflow'}], [('AB€x', 3), {'error': 'unencodable'}], [(' 12\x80x', 7), [33, 142, 235, 1, 121, 129, 161]]]]
labels = ["regression: first pad codeword", "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: first pad codeword 0[25, 175, 70, 220, 115, 11][129, 175, 70, 220, 115, 11]Failed
repair trap 1[235, 1, 70, 220][235, 1, 129, 220]Failed
combined fault 2{'error': 'overflow'}{'error': 'overflow'}Passed
control 3{'error': 'overflow'}{'error': 'overflow'}Passed
control 4{'error': 'unencodable'}{'error': 'unencodable'}Passed
boundary 5{'error': 'overflow'}{'error': 'overflow'}Passed
boundary 6{'error': 'overflow'}{'error': 'overflow'}Passed
control 7[229, 121, 70, 220, 115][229, 121, 129, 220, 115]Failed

SHA-256 / c36da54839c7abb847f010566838f485213e1e5e1d23caa81b48a4f8bc6b8884

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(text, capacity):
    cw = []
    i = 0
    while i < len(text):
        c = text[i]
        if c in '0123456789' and i + 1 < len(text) and text[i + 1] in '0123456789':
            cw.append(130 + int(text[i:i + 2]))
            i += 2
            continue
        o = ord(c)
        if o > 255:
            return {'error': 'unencodable'}
        if o > 127:
            cw += [235, o - 127]
        else:
            cw.append(o + 1)
        i += 1
    if len(cw) > capacity:
        return {'error': 'overflow'}
    if len(cw) < capacity:
        cw.append(128)
    while len(cw) < capacity:
        p = len(cw) + 1
        v = 129 + ((149 * p) % 253) + 1
        if v > 254:
            v -= 254
        cw.append(v)
    return cw
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('', 6), [129, 175, 70, 220, 115, 11]], [('\x80', 4), [235, 1, 129, 220]], [('0AB12', 3), {'error': 'overflow'}], [('ABé', 1), {'error': 'overflow'}], [('AB€€', 10), {'error': 'unencodable'}], [(' ÿ5', 2), {'error': 'overflow'}], [('é \x80AB', 4), {'error': 'overflow'}], [('99x', 5), [229, 121, 129, 220, 115]]], [[(' ABAB12', 8), [33, 66, 67, 66, 67, 142, 129, 56]], [('x', 4), [121, 129, 70, 220]], [('x€', 10), {'error': 'unencodable'}], [(' 125', 1), {'error': 'overflow'}], [('99€x', 6), {'error': 'unencodable'}], [('ÿ€', 10), {'error': 'unencodable'}], [(' €5', 5), {'error': 'unencodable'}], [(' AB', 4), [33, 66, 67, 129]]], [[('', 4), [129, 175, 70, 220]], [('99é0', 5), [229, 235, 106, 49, 129]], [('éé', 3), {'error': 'overflow'}], [('é\x80\x80', 3), {'error': 'overflow'}], [('€', 6), {'error': 'unencodable'}], [('xAB99', 2), {'error': 'overflow'}], [('12é\x80', 1), {'error': 'overflow'}], [('x99AB', 11), [121, 229, 66, 67, 129, 11, 161, 56, 206, 101, 251]]], [[('0xÿ', 8), [49, 121, 235, 128, 129, 11, 161, 56]], [('99', 3), [229, 129, 70]], [('\x8012x5', 1), {'error': 'overflow'}], [(' €ÿ\x80', 5), {'error': 'unencodable'}], [('AB€x', 2), {'error': 'unencodable'}], [('€ ', 4), {'error': 'unencodable'}], [('€', 2), {'error': 'unencodable'}], [('', 6), [129, 175, 70, 220, 115, 11]]], [[('', 7), [129, 175, 70, 220, 115, 11, 161]], [('xÿ99', 9), [121, 235, 128, 229, 129, 11, 161, 56, 206]], [('\x80€ 0', 8), {'error': 'unencodable'}], [('€99', 7), {'error': 'unencodable'}], [('€\x80', 9), {'error': 'unencodable'}], [('\x80', 1), {'error': 'overflow'}], [('AB€x', 3), {'error': 'unencodable'}], [(' 12\x80x', 7), [33, 142, 235, 1, 121, 129, 161]]]]
labels = ["regression: first pad codeword", "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: first pad codeword 0[128, 175, 70, 220, 115, 11][129, 175, 70, 220, 115, 11]Failed
repair trap 1[235, 1, 128, 220][235, 1, 129, 220]Failed
combined fault 2{'error': 'overflow'}{'error': 'overflow'}Passed
control 3{'error': 'overflow'}{'error': 'overflow'}Passed
control 4{'error': 'unencodable'}{'error': 'unencodable'}Passed
boundary 5{'error': 'overflow'}{'error': 'overflow'}Passed
boundary 6{'error': 'overflow'}{'error': 'overflow'}Passed
control 7[229, 121, 128, 220, 115][229, 121, 129, 220, 115]Failed

SHA-256 / b7dd372edc2191c93767fd2eb81f01716f3b16a7bc9ad0cbb323f0ce6ee7252a

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:47.893367+00:00.

Case digest / 250944c19ab7ee2c00b96d6e52d9edf3d046b0c122a11674fb15d21c0a7e365f