FAILURE MAP
← Case archive

FA-79616 / Barcode symbology encoding / Open access

Fixed-length field swallows a separator · case 01

A truncated GTIN followed by a separator parses as a GTIN containing GS and shifts every later field.

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

ROOT CAUSE

Fixed-length values are only length-checked, so a premature separator is consumed as data.

VERIFIED REPAIR

Reject a fixed field that contains GS.

Unsuccessful approach: Checking only the last character misses a separator in the middle.

Case contract

Parse scanner output of a GS1-128 symbol: it must start with the symbology identifier "]C1"; FNC1 separators arrive as GS (0x1D) and redundant separators are skipped. AIs are recognised by the shortest matching prefix among the predefined fixed-length AIs (00:18, 01/02:14, 11/13/15/17:6, 3103:6) and variable AIs (10/21 max 20, 30/37 max 8, 400 max 30). A fixed field must be complete and contain no GS; a variable field runs to the next GS or the end and must have 1..max characters. Return [[ai, value], ...] or an error.

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(s):
    fixed_len = {'00': 18, '01': 14, '02': 14, '11': 6, '13': 6, '15': 6, '17': 6, '3103': 6}
    var_max = {'10': 20, '21': 20, '30': 8, '37': 8, '400': 30}
    if not s.startswith(']C1'):
        return {'error': 'not-gs1'}
    i = 3
    out = []
    while i < len(s):
        if s[i] == '\x1d':
            i += 1
            continue
        ai = None
        for L in (2, 3, 4):
            if s[i:i + L] in fixed_len or s[i:i + L] in var_max:
                ai = s[i:i + L]
                break
        if ai is None:
            return {'error': 'unknown-ai', 'at': i}
        i += len(ai)
        if ai in fixed_len:
            n = fixed_len[ai]
            val = s[i:i + n]
            if len(val) != n:
                return {'error': 'short', 'ai': ai}
            i += n
        else:
            j = s.find('\x1d', i)
            if j == -1:
                j = len(s)
            val = s[i:j]
            if not 1 <= len(val) <= var_max[ai]:
                return {'error': 'length', 'ai': ai}
            i = j
        out.append([ai, val])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[']C101000170614774\x1d302\x1d310351684717', {'error': 'short', 'ai': '01'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C011400783', {'error': 'not-gs1'}], [']C03019\x1d10B9', {'error': 'not-gs1'}], [']C117140648306\x1d0141294680397442\x1d', [['17', '140648'], ['30', '6'], ['01', '41294680397442']]], [']d221B-1BA9-B\x1d219X91//1X9-/1A-C\x1d10BBCB1-9/-/9//-/BC1-A-X\x1d21/ABXAX9C-CC/-\x1d', {'error': 'not-gs1'}], [']C0\x1d3028612956', {'error': 'not-gs1'}], [']C11724010\x1d10A', {'error': 'short', 'ai': '17'}]], [[']C11724010\x1d10A', {'error': 'short', 'ai': '17'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C04009\x1d10X-CXA1/X\x1d310311958730', {'error': 'not-gs1'}], [']C10044603095506351280311060380310300579483495402726338', {'error': 'unknown-ai', 'at': 41}], [']d211029205\x1d01139908024073283027281846\x1d10-X9C\x1d', {'error': 'not-gs1'}], [']C1310361473240011XBBC-1-CX1B-\x1d371255\x1d219X9B-C/', [['3103', '614732'], ['400', '11XBBC-1-CX1B-'], ['37', '1255'], ['21', '9X9B-C/']]], [']C030473952263\x1d375323374', {'error': 'not-gs1'}], [']C137186\x1d4001AC/BA9/1CB/X/A1XC\x1d0176580975297815\x1d377740072\x1d', [['37', '186'], ['400', '1AC/BA9/1CB/X/A1XC'], ['01', '76580975297815'], ['37', '7740072']]]], [[']C11724010\x1d10A', {'error': 'short', 'ai': '17'}], [']C111990558117862\x1d10X-11\x1d0141668383672539', {'error': 'short', 'ai': '11'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C111362276', [['11', '362276']]], [']C121C-\x1d3103238166', [['21', 'C-'], ['3103', '238166']]], [']C121-/1-X-9B\x1d17420369015026678280984317842704\x1d', [['21', '-/1-X-9B'], ['17', '420369'], ['01', '50266782809843'], ['17', '842704']]], [']d2002942508545382808993103171446', {'error': 'not-gs1'}], [']d230902446359', {'error': 'not-gs1'}]], [[']C13781653\x1d211/BCXC9C99BX9-\x1d17\x1d10C1--9AA/9X9XB1B/B1A', {'error': 'short', 'ai': '17'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C11100096530067\x1d17348048', [['11', '000965'], ['30', '067'], ['17', '348048']]], [']C1211\x1d400/B-\x1d3067920\x1d', [['21', '1'], ['400', '/B-'], ['30', '67920']]], [']C1211CXX-B1B9XXX-/', [['21', '1CXX-B1B9XXX-/']]], [']C1308705431', [['30', '8705431']]], [']C010/ACC1C1C/9\x1d109\x1d00997634519263772689', {'error': 'not-gs1'}], [']C11724010\x1d10A', {'error': 'short', 'ai': '17'}]], [[']C1\x1d17\x1d10A9A/-X/C/C1\x1d310336266817484500', {'error': 'short', 'ai': '17'}], [']C1003768967\x1d37189245560\x1d11863910', {'error': 'short', 'ai': '00'}], [']C037218164131\x1d017878870121363103882288', {'error': 'not-gs1'}], [']C10109147699409412219X9/BACAA-C1/9X19-B\x1d21/\x1d17759960', [['01', '09147699409412'], ['21', '9X9/BACAA-C1/9X19-B'], ['21', '/'], ['17', '759960']]], [']C01109918000653062932206451941', {'error': 'not-gs1'}], [']C017335622\x1d10/A/1X9\x1d1019911-1X/1B1/C-B\x1d400AX/C', {'error': 'not-gs1'}], [']C121BCAB-C9CCX1/9X/CCX/1-A\x1d3103050801250114151498', {'error': 'length', 'ai': '21'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}]]]
labels = ["regression: separator inside a fixed field", "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: separator inside a fixed field 0{'ai': '02', 'error': 'short'}{'ai': '01', 'error': 'short'}Failed
repair trap 1{'at': 19, 'error': 'unknown-ai'}{'ai': '01', 'error': 'short'}Failed
combined fault 2{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 3{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 4[['17', '140648'], ['30', '6'], ['01', '41294680397442']][['17', '140648'], ['30', '6'], ['01', '41294680397442']]Passed
boundary 5{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
boundary 6{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 7[['17', '24010\x1d'], ['10', 'A']]{'ai': '17', 'error': 'short'}Failed

SHA-256 / 63be5af48c0d51c7d019d58d35057afbb25682ca5c5f4b825588c8b17045464f

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(s):
    fixed_len = {'00': 18, '01': 14, '02': 14, '11': 6, '13': 6, '15': 6, '17': 6, '3103': 6}
    var_max = {'10': 20, '21': 20, '30': 8, '37': 8, '400': 30}
    if not s.startswith(']C1'):
        return {'error': 'not-gs1'}
    i = 3
    out = []
    while i < len(s):
        if s[i] == '\x1d':
            i += 1
            continue
        ai = None
        for L in (2, 3, 4):
            if s[i:i + L] in fixed_len or s[i:i + L] in var_max:
                ai = s[i:i + L]
                break
        if ai is None:
            return {'error': 'unknown-ai', 'at': i}
        i += len(ai)
        if ai in fixed_len:
            n = fixed_len[ai]
            val = s[i:i + n]
            if len(val) != n or val.endswith('\x1d'):
                return {'error': 'short', 'ai': ai}
            i += n
        else:
            j = s.find('\x1d', i)
            if j == -1:
                j = len(s)
            val = s[i:j]
            if not 1 <= len(val) <= var_max[ai]:
                return {'error': 'length', 'ai': ai}
            i = j
        out.append([ai, val])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[']C101000170614774\x1d302\x1d310351684717', {'error': 'short', 'ai': '01'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C011400783', {'error': 'not-gs1'}], [']C03019\x1d10B9', {'error': 'not-gs1'}], [']C117140648306\x1d0141294680397442\x1d', [['17', '140648'], ['30', '6'], ['01', '41294680397442']]], [']d221B-1BA9-B\x1d219X91//1X9-/1A-C\x1d10BBCB1-9/-/9//-/BC1-A-X\x1d21/ABXAX9C-CC/-\x1d', {'error': 'not-gs1'}], [']C0\x1d3028612956', {'error': 'not-gs1'}], [']C11724010\x1d10A', {'error': 'short', 'ai': '17'}]], [[']C11724010\x1d10A', {'error': 'short', 'ai': '17'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C04009\x1d10X-CXA1/X\x1d310311958730', {'error': 'not-gs1'}], [']C10044603095506351280311060380310300579483495402726338', {'error': 'unknown-ai', 'at': 41}], [']d211029205\x1d01139908024073283027281846\x1d10-X9C\x1d', {'error': 'not-gs1'}], [']C1310361473240011XBBC-1-CX1B-\x1d371255\x1d219X9B-C/', [['3103', '614732'], ['400', '11XBBC-1-CX1B-'], ['37', '1255'], ['21', '9X9B-C/']]], [']C030473952263\x1d375323374', {'error': 'not-gs1'}], [']C137186\x1d4001AC/BA9/1CB/X/A1XC\x1d0176580975297815\x1d377740072\x1d', [['37', '186'], ['400', '1AC/BA9/1CB/X/A1XC'], ['01', '76580975297815'], ['37', '7740072']]]], [[']C11724010\x1d10A', {'error': 'short', 'ai': '17'}], [']C111990558117862\x1d10X-11\x1d0141668383672539', {'error': 'short', 'ai': '11'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C111362276', [['11', '362276']]], [']C121C-\x1d3103238166', [['21', 'C-'], ['3103', '238166']]], [']C121-/1-X-9B\x1d17420369015026678280984317842704\x1d', [['21', '-/1-X-9B'], ['17', '420369'], ['01', '50266782809843'], ['17', '842704']]], [']d2002942508545382808993103171446', {'error': 'not-gs1'}], [']d230902446359', {'error': 'not-gs1'}]], [[']C13781653\x1d211/BCXC9C99BX9-\x1d17\x1d10C1--9AA/9X9XB1B/B1A', {'error': 'short', 'ai': '17'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C11100096530067\x1d17348048', [['11', '000965'], ['30', '067'], ['17', '348048']]], [']C1211\x1d400/B-\x1d3067920\x1d', [['21', '1'], ['400', '/B-'], ['30', '67920']]], [']C1211CXX-B1B9XXX-/', [['21', '1CXX-B1B9XXX-/']]], [']C1308705431', [['30', '8705431']]], [']C010/ACC1C1C/9\x1d109\x1d00997634519263772689', {'error': 'not-gs1'}], [']C11724010\x1d10A', {'error': 'short', 'ai': '17'}]], [[']C1\x1d17\x1d10A9A/-X/C/C1\x1d310336266817484500', {'error': 'short', 'ai': '17'}], [']C1003768967\x1d37189245560\x1d11863910', {'error': 'short', 'ai': '00'}], [']C037218164131\x1d017878870121363103882288', {'error': 'not-gs1'}], [']C10109147699409412219X9/BACAA-C1/9X19-B\x1d21/\x1d17759960', [['01', '09147699409412'], ['21', '9X9/BACAA-C1/9X19-B'], ['21', '/'], ['17', '759960']]], [']C01109918000653062932206451941', {'error': 'not-gs1'}], [']C017335622\x1d10/A/1X9\x1d1019911-1X/1B1/C-B\x1d400AX/C', {'error': 'not-gs1'}], [']C121BCAB-C9CCX1/9X/CCX/1-A\x1d3103050801250114151498', {'error': 'length', 'ai': '21'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}]]]
labels = ["regression: separator inside a fixed field", "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: separator inside a fixed field 0{'ai': '02', 'error': 'short'}{'ai': '01', 'error': 'short'}Failed
repair trap 1{'at': 19, 'error': 'unknown-ai'}{'ai': '01', 'error': 'short'}Failed
combined fault 2{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 3{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 4[['17', '140648'], ['30', '6'], ['01', '41294680397442']][['17', '140648'], ['30', '6'], ['01', '41294680397442']]Passed
boundary 5{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
boundary 6{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 7{'ai': '17', 'error': 'short'}{'ai': '17', 'error': 'short'}Passed

SHA-256 / 49d89fd1b9a5382f6d43827f222e06b93f6e61e2c607b47f1630f261cb6b1410

3 / The verified repair

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

N = 1
observations = []
def solve(s):
    fixed_len = {'00': 18, '01': 14, '02': 14, '11': 6, '13': 6, '15': 6, '17': 6, '3103': 6}
    var_max = {'10': 20, '21': 20, '30': 8, '37': 8, '400': 30}
    if not s.startswith(']C1'):
        return {'error': 'not-gs1'}
    i = 3
    out = []
    while i < len(s):
        if s[i] == '\x1d':
            i += 1
            continue
        ai = None
        for L in (2, 3, 4):
            if s[i:i + L] in fixed_len or s[i:i + L] in var_max:
                ai = s[i:i + L]
                break
        if ai is None:
            return {'error': 'unknown-ai', 'at': i}
        i += len(ai)
        if ai in fixed_len:
            n = fixed_len[ai]
            val = s[i:i + n]
            if len(val) != n or '\x1d' in val:
                return {'error': 'short', 'ai': ai}
            i += n
        else:
            j = s.find('\x1d', i)
            if j == -1:
                j = len(s)
            val = s[i:j]
            if not 1 <= len(val) <= var_max[ai]:
                return {'error': 'length', 'ai': ai}
            i = j
        out.append([ai, val])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[']C101000170614774\x1d302\x1d310351684717', {'error': 'short', 'ai': '01'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C011400783', {'error': 'not-gs1'}], [']C03019\x1d10B9', {'error': 'not-gs1'}], [']C117140648306\x1d0141294680397442\x1d', [['17', '140648'], ['30', '6'], ['01', '41294680397442']]], [']d221B-1BA9-B\x1d219X91//1X9-/1A-C\x1d10BBCB1-9/-/9//-/BC1-A-X\x1d21/ABXAX9C-CC/-\x1d', {'error': 'not-gs1'}], [']C0\x1d3028612956', {'error': 'not-gs1'}], [']C11724010\x1d10A', {'error': 'short', 'ai': '17'}]], [[']C11724010\x1d10A', {'error': 'short', 'ai': '17'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C04009\x1d10X-CXA1/X\x1d310311958730', {'error': 'not-gs1'}], [']C10044603095506351280311060380310300579483495402726338', {'error': 'unknown-ai', 'at': 41}], [']d211029205\x1d01139908024073283027281846\x1d10-X9C\x1d', {'error': 'not-gs1'}], [']C1310361473240011XBBC-1-CX1B-\x1d371255\x1d219X9B-C/', [['3103', '614732'], ['400', '11XBBC-1-CX1B-'], ['37', '1255'], ['21', '9X9B-C/']]], [']C030473952263\x1d375323374', {'error': 'not-gs1'}], [']C137186\x1d4001AC/BA9/1CB/X/A1XC\x1d0176580975297815\x1d377740072\x1d', [['37', '186'], ['400', '1AC/BA9/1CB/X/A1XC'], ['01', '76580975297815'], ['37', '7740072']]]], [[']C11724010\x1d10A', {'error': 'short', 'ai': '17'}], [']C111990558117862\x1d10X-11\x1d0141668383672539', {'error': 'short', 'ai': '11'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C111362276', [['11', '362276']]], [']C121C-\x1d3103238166', [['21', 'C-'], ['3103', '238166']]], [']C121-/1-X-9B\x1d17420369015026678280984317842704\x1d', [['21', '-/1-X-9B'], ['17', '420369'], ['01', '50266782809843'], ['17', '842704']]], [']d2002942508545382808993103171446', {'error': 'not-gs1'}], [']d230902446359', {'error': 'not-gs1'}]], [[']C13781653\x1d211/BCXC9C99BX9-\x1d17\x1d10C1--9AA/9X9XB1B/B1A', {'error': 'short', 'ai': '17'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}], [']C11100096530067\x1d17348048', [['11', '000965'], ['30', '067'], ['17', '348048']]], [']C1211\x1d400/B-\x1d3067920\x1d', [['21', '1'], ['400', '/B-'], ['30', '67920']]], [']C1211CXX-B1B9XXX-/', [['21', '1CXX-B1B9XXX-/']]], [']C1308705431', [['30', '8705431']]], [']C010/ACC1C1C/9\x1d109\x1d00997634519263772689', {'error': 'not-gs1'}], [']C11724010\x1d10A', {'error': 'short', 'ai': '17'}]], [[']C1\x1d17\x1d10A9A/-X/C/C1\x1d310336266817484500', {'error': 'short', 'ai': '17'}], [']C1003768967\x1d37189245560\x1d11863910', {'error': 'short', 'ai': '00'}], [']C037218164131\x1d017878870121363103882288', {'error': 'not-gs1'}], [']C10109147699409412219X9/BACAA-C1/9X19-B\x1d21/\x1d17759960', [['01', '09147699409412'], ['21', '9X9/BACAA-C1/9X19-B'], ['21', '/'], ['17', '759960']]], [']C01109918000653062932206451941', {'error': 'not-gs1'}], [']C017335622\x1d10/A/1X9\x1d1019911-1X/1B1/C-B\x1d400AX/C', {'error': 'not-gs1'}], [']C121BCAB-C9CCX1/9X/CCX/1-A\x1d3103050801250114151498', {'error': 'length', 'ai': '21'}], [']C1011234567\x1d10ABCDEFG', {'error': 'short', 'ai': '01'}]]]
labels = ["regression: separator inside a fixed field", "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: separator inside a fixed field 0{'ai': '01', 'error': 'short'}{'ai': '01', 'error': 'short'}Passed
repair trap 1{'ai': '01', 'error': 'short'}{'ai': '01', 'error': 'short'}Passed
combined fault 2{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 3{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 4[['17', '140648'], ['30', '6'], ['01', '41294680397442']][['17', '140648'], ['30', '6'], ['01', '41294680397442']]Passed
boundary 5{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
boundary 6{'error': 'not-gs1'}{'error': 'not-gs1'}Passed
control 7{'ai': '17', 'error': 'short'}{'ai': '17', 'error': 'short'}Passed

SHA-256 / bfb72e3530005669a7923e31dfb06bf616b1131bc03761cc62588e482d794192

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

Case digest / b26ee5b1cac920937124aa067aaea335dc0bb5c109204fbba054a4b053b22cd2