FAILURE MAP
← Case archive

FA-79596 / Barcode symbology encoding / Open access

Count AIs accept letters · case 01

A quantity field with a letter passes validation and fails downstream EDI parsing.

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

ROOT CAUSE

The variable-length count AIs 30 and 37 are missing from the numeric set.

VERIFIED REPAIR

Include 30 and 37 among numeric-only AIs.

Unsuccessful approach: Dropping 3103 instead lets net weights contain letters.

Case contract

Assemble GS1-128 data from [AI, value] pairs; "#" stands for FNC1. The string starts with FNC1. Predefined fixed-length AIs: 00 (18), 01 and 02 (14), 11/13/15/17 (6), 3103 (6); variable-length AIs with maximum length: 10 and 21 (20), 30 and 37 (8), 400 (30). Numeric AIs: 00, 01, 02, 11, 13, 15, 17, 3103, 30, 37. Values use printable ASCII 33..126 except "#". A variable-length field is followed by FNC1 unless it is last. Errors: unknown-ai, bad-value.

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(fields):
    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}
    numeric = {'00', '01', '02', '11', '13', '15', '17', '3103'}
    out = '#'
    for idx, (ai, val) in enumerate(fields):
        if ai in fixed_len:
            if len(val) != fixed_len[ai]:
                return {'error': 'bad-value', 'ai': ai}
        elif ai in var_max:
            if not 1 <= len(val) <= var_max[ai]:
                return {'error': 'bad-value', 'ai': ai}
        else:
            return {'error': 'unknown-ai', 'ai': ai}
        if ai in numeric and not all(c in '0123456789' for c in val):
            return {'error': 'bad-value', 'ai': ai}
        if not all(33 <= ord(c) <= 126 and c != '#' for c in val):
            return {'error': 'bad-value', 'ai': ai}
        out += ai + val
        if ai in var_max and idx < len(fields) - 1:
            out += '#'
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['00', '985817250537365954'], ['01', '79711415997882'], ['37', '555608A']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '95878A'], ['01', '69230180164675'], ['37', '']], {'error': 'bad-value', 'ai': '3103'}], [[['17', '124248'], ['400', 'BAB1XXX/9BAB1B1XC1BCX'], ['30', '86711'], ['11', '769392']], '#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392'], [[['400', 'X9B1-1X9--'], ['3103', '754725'], ['30', '31441746']], '#400X9B1-1X9--#31037547253031441746'], [[['00', '90045075234391735A']], {'error': 'bad-value', 'ai': '00'}], [[['30', '314304438']], {'error': 'bad-value', 'ai': '30'}], [[['30', '498926295']], {'error': 'bad-value', 'ai': '30'}], [[['10', '99/9/X19CX/91-B/'], ['01', '96479291633896'], ['400', 'X1/BA/BCAB1'], ['37', '3970A']], {'error': 'bad-value', 'ai': '37'}]], [[[['37', '72397A'], ['02', '52520928618727'], ['01', '05863002386973']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['11', '827833']], '#11827833'], [[['10', '999B9'], ['02', '83916947090792'], ['02', '6235977446030']], {'error': 'bad-value', 'ai': '02'}], [[['17', '194565'], ['3103', '606142'], ['11', '39946#'], ['13', '993221']], {'error': 'bad-value', 'ai': '11'}], [[['15', '20240101'], ['01', '50134768665104']], {'error': 'bad-value', 'ai': '15'}], [[['15', '102414'], ['30', '347034523'], ['11', '22408']], {'error': 'bad-value', 'ai': '30'}], [[['02', '15838863816538'], ['37', '50500A']], {'error': 'bad-value', 'ai': '37'}]], [[[['01', '09501101530003'], ['37', '4B']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['400', '-']], '#400-'], [[['3103', '826746'], ['37', '0899595'], ['01', '55301929154724'], ['17', '991161']], '#3103826746370899595#015530192915472417991161'], [[['3103', '506096'], ['30', '1'], ['11', '465886']], '#3103506096301#11465886'], [[['3103', '']], {'error': 'bad-value', 'ai': '3103'}], [[['01', '16614057569424'], ['01', '04741883691497'], ['3103', '20240101'], ['17', '174564']], {'error': 'bad-value', 'ai': '3103'}], [[['30', '12A']], {'error': 'bad-value', 'ai': '30'}]], [[[['30', '12A']], {'error': 'bad-value', 'ai': '30'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['15', '60641#'], ['13', '753605']], {'error': 'bad-value', 'ai': '15'}], [[['400', '-CA9C-XA1X-9A/CBA/91-']], '#400-CA9C-XA1X-9A/CBA/91-'], [[['15', '29986'], ['11', '20240101']], {'error': 'bad-value', 'ai': '15'}], [[['17', ''], ['11', ''], ['13', '934852']], {'error': 'bad-value', 'ai': '17'}], [[['11', '293752']], '#11293752'], [[['30', '07254285'], ['37', '736A']], {'error': 'bad-value', 'ai': '37'}]], [[[['30', '12A']], {'error': 'bad-value', 'ai': '30'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['01', '88338443484420'], ['15', '924591'], ['37', '']], {'error': 'bad-value', 'ai': '37'}], [[['15', '009908'], ['11', '813644']], '#1500990811813644'], [[['3103', '391395'], ['37', '67'], ['17', '083210'], ['00', '300168916917459102']], '#31033913953767#1708321000300168916917459102'], [[['30', ''], ['13', '195409']], {'error': 'bad-value', 'ai': '30'}], [[['01', '21550398685673'], ['15', '789070'], ['13', '754989']], '#01215503986856731578907013754989'], [[['01', '09501101530003'], ['37', '4B']], {'error': 'bad-value', 'ai': '37'}]]]
labels = ["regression: numeric AI set", "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: numeric AI set 0#00985817250537365954017971141599788237555608A{'ai': '37', 'error': 'bad-value'}Failed
repair trap 1{'ai': '3103', 'error': 'bad-value'}{'ai': '3103', 'error': 'bad-value'}Passed
combined fault 2#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392Passed
control 3#400X9B1-1X9--#31037547253031441746#400X9B1-1X9--#31037547253031441746Passed
control 4{'ai': '00', 'error': 'bad-value'}{'ai': '00', 'error': 'bad-value'}Passed
boundary 5{'ai': '30', 'error': 'bad-value'}{'ai': '30', 'error': 'bad-value'}Passed
boundary 6{'ai': '30', 'error': 'bad-value'}{'ai': '30', 'error': 'bad-value'}Passed
control 7#1099/9/X19CX/91-B/#0196479291633896400X1/BA/BCAB1#373970A{'ai': '37', 'error': 'bad-value'}Failed

SHA-256 / d746cbc505a0f03abfc909d306d24daa1309a92862f6d41314ca27bf4bf20b3d

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(fields):
    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}
    numeric = {'00', '01', '02', '11', '13', '15', '17', '30', '37'}
    out = '#'
    for idx, (ai, val) in enumerate(fields):
        if ai in fixed_len:
            if len(val) != fixed_len[ai]:
                return {'error': 'bad-value', 'ai': ai}
        elif ai in var_max:
            if not 1 <= len(val) <= var_max[ai]:
                return {'error': 'bad-value', 'ai': ai}
        else:
            return {'error': 'unknown-ai', 'ai': ai}
        if ai in numeric and not all(c in '0123456789' for c in val):
            return {'error': 'bad-value', 'ai': ai}
        if not all(33 <= ord(c) <= 126 and c != '#' for c in val):
            return {'error': 'bad-value', 'ai': ai}
        out += ai + val
        if ai in var_max and idx < len(fields) - 1:
            out += '#'
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['00', '985817250537365954'], ['01', '79711415997882'], ['37', '555608A']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '95878A'], ['01', '69230180164675'], ['37', '']], {'error': 'bad-value', 'ai': '3103'}], [[['17', '124248'], ['400', 'BAB1XXX/9BAB1B1XC1BCX'], ['30', '86711'], ['11', '769392']], '#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392'], [[['400', 'X9B1-1X9--'], ['3103', '754725'], ['30', '31441746']], '#400X9B1-1X9--#31037547253031441746'], [[['00', '90045075234391735A']], {'error': 'bad-value', 'ai': '00'}], [[['30', '314304438']], {'error': 'bad-value', 'ai': '30'}], [[['30', '498926295']], {'error': 'bad-value', 'ai': '30'}], [[['10', '99/9/X19CX/91-B/'], ['01', '96479291633896'], ['400', 'X1/BA/BCAB1'], ['37', '3970A']], {'error': 'bad-value', 'ai': '37'}]], [[[['37', '72397A'], ['02', '52520928618727'], ['01', '05863002386973']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['11', '827833']], '#11827833'], [[['10', '999B9'], ['02', '83916947090792'], ['02', '6235977446030']], {'error': 'bad-value', 'ai': '02'}], [[['17', '194565'], ['3103', '606142'], ['11', '39946#'], ['13', '993221']], {'error': 'bad-value', 'ai': '11'}], [[['15', '20240101'], ['01', '50134768665104']], {'error': 'bad-value', 'ai': '15'}], [[['15', '102414'], ['30', '347034523'], ['11', '22408']], {'error': 'bad-value', 'ai': '30'}], [[['02', '15838863816538'], ['37', '50500A']], {'error': 'bad-value', 'ai': '37'}]], [[[['01', '09501101530003'], ['37', '4B']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['400', '-']], '#400-'], [[['3103', '826746'], ['37', '0899595'], ['01', '55301929154724'], ['17', '991161']], '#3103826746370899595#015530192915472417991161'], [[['3103', '506096'], ['30', '1'], ['11', '465886']], '#3103506096301#11465886'], [[['3103', '']], {'error': 'bad-value', 'ai': '3103'}], [[['01', '16614057569424'], ['01', '04741883691497'], ['3103', '20240101'], ['17', '174564']], {'error': 'bad-value', 'ai': '3103'}], [[['30', '12A']], {'error': 'bad-value', 'ai': '30'}]], [[[['30', '12A']], {'error': 'bad-value', 'ai': '30'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['15', '60641#'], ['13', '753605']], {'error': 'bad-value', 'ai': '15'}], [[['400', '-CA9C-XA1X-9A/CBA/91-']], '#400-CA9C-XA1X-9A/CBA/91-'], [[['15', '29986'], ['11', '20240101']], {'error': 'bad-value', 'ai': '15'}], [[['17', ''], ['11', ''], ['13', '934852']], {'error': 'bad-value', 'ai': '17'}], [[['11', '293752']], '#11293752'], [[['30', '07254285'], ['37', '736A']], {'error': 'bad-value', 'ai': '37'}]], [[[['30', '12A']], {'error': 'bad-value', 'ai': '30'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['01', '88338443484420'], ['15', '924591'], ['37', '']], {'error': 'bad-value', 'ai': '37'}], [[['15', '009908'], ['11', '813644']], '#1500990811813644'], [[['3103', '391395'], ['37', '67'], ['17', '083210'], ['00', '300168916917459102']], '#31033913953767#1708321000300168916917459102'], [[['30', ''], ['13', '195409']], {'error': 'bad-value', 'ai': '30'}], [[['01', '21550398685673'], ['15', '789070'], ['13', '754989']], '#01215503986856731578907013754989'], [[['01', '09501101530003'], ['37', '4B']], {'error': 'bad-value', 'ai': '37'}]]]
labels = ["regression: numeric AI set", "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: numeric AI set 0{'ai': '37', 'error': 'bad-value'}{'ai': '37', 'error': 'bad-value'}Passed
repair trap 1{'ai': '37', 'error': 'bad-value'}{'ai': '3103', 'error': 'bad-value'}Failed
combined fault 2#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392Passed
control 3#400X9B1-1X9--#31037547253031441746#400X9B1-1X9--#31037547253031441746Passed
control 4{'ai': '00', 'error': 'bad-value'}{'ai': '00', 'error': 'bad-value'}Passed
boundary 5{'ai': '30', 'error': 'bad-value'}{'ai': '30', 'error': 'bad-value'}Passed
boundary 6{'ai': '30', 'error': 'bad-value'}{'ai': '30', 'error': 'bad-value'}Passed
control 7{'ai': '37', 'error': 'bad-value'}{'ai': '37', 'error': 'bad-value'}Passed

SHA-256 / 93b28d676debdb9b338dca199fea8057f93e42304d744d59c76a846e0a0c5cf0

3 / The verified repair

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

N = 1
observations = []
def solve(fields):
    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}
    numeric = {'00', '01', '02', '11', '13', '15', '17', '3103', '30', '37'}
    out = '#'
    for idx, (ai, val) in enumerate(fields):
        if ai in fixed_len:
            if len(val) != fixed_len[ai]:
                return {'error': 'bad-value', 'ai': ai}
        elif ai in var_max:
            if not 1 <= len(val) <= var_max[ai]:
                return {'error': 'bad-value', 'ai': ai}
        else:
            return {'error': 'unknown-ai', 'ai': ai}
        if ai in numeric and not all(c in '0123456789' for c in val):
            return {'error': 'bad-value', 'ai': ai}
        if not all(33 <= ord(c) <= 126 and c != '#' for c in val):
            return {'error': 'bad-value', 'ai': ai}
        out += ai + val
        if ai in var_max and idx < len(fields) - 1:
            out += '#'
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['00', '985817250537365954'], ['01', '79711415997882'], ['37', '555608A']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '95878A'], ['01', '69230180164675'], ['37', '']], {'error': 'bad-value', 'ai': '3103'}], [[['17', '124248'], ['400', 'BAB1XXX/9BAB1B1XC1BCX'], ['30', '86711'], ['11', '769392']], '#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392'], [[['400', 'X9B1-1X9--'], ['3103', '754725'], ['30', '31441746']], '#400X9B1-1X9--#31037547253031441746'], [[['00', '90045075234391735A']], {'error': 'bad-value', 'ai': '00'}], [[['30', '314304438']], {'error': 'bad-value', 'ai': '30'}], [[['30', '498926295']], {'error': 'bad-value', 'ai': '30'}], [[['10', '99/9/X19CX/91-B/'], ['01', '96479291633896'], ['400', 'X1/BA/BCAB1'], ['37', '3970A']], {'error': 'bad-value', 'ai': '37'}]], [[[['37', '72397A'], ['02', '52520928618727'], ['01', '05863002386973']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['11', '827833']], '#11827833'], [[['10', '999B9'], ['02', '83916947090792'], ['02', '6235977446030']], {'error': 'bad-value', 'ai': '02'}], [[['17', '194565'], ['3103', '606142'], ['11', '39946#'], ['13', '993221']], {'error': 'bad-value', 'ai': '11'}], [[['15', '20240101'], ['01', '50134768665104']], {'error': 'bad-value', 'ai': '15'}], [[['15', '102414'], ['30', '347034523'], ['11', '22408']], {'error': 'bad-value', 'ai': '30'}], [[['02', '15838863816538'], ['37', '50500A']], {'error': 'bad-value', 'ai': '37'}]], [[[['01', '09501101530003'], ['37', '4B']], {'error': 'bad-value', 'ai': '37'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['400', '-']], '#400-'], [[['3103', '826746'], ['37', '0899595'], ['01', '55301929154724'], ['17', '991161']], '#3103826746370899595#015530192915472417991161'], [[['3103', '506096'], ['30', '1'], ['11', '465886']], '#3103506096301#11465886'], [[['3103', '']], {'error': 'bad-value', 'ai': '3103'}], [[['01', '16614057569424'], ['01', '04741883691497'], ['3103', '20240101'], ['17', '174564']], {'error': 'bad-value', 'ai': '3103'}], [[['30', '12A']], {'error': 'bad-value', 'ai': '30'}]], [[[['30', '12A']], {'error': 'bad-value', 'ai': '30'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['15', '60641#'], ['13', '753605']], {'error': 'bad-value', 'ai': '15'}], [[['400', '-CA9C-XA1X-9A/CBA/91-']], '#400-CA9C-XA1X-9A/CBA/91-'], [[['15', '29986'], ['11', '20240101']], {'error': 'bad-value', 'ai': '15'}], [[['17', ''], ['11', ''], ['13', '934852']], {'error': 'bad-value', 'ai': '17'}], [[['11', '293752']], '#11293752'], [[['30', '07254285'], ['37', '736A']], {'error': 'bad-value', 'ai': '37'}]], [[[['30', '12A']], {'error': 'bad-value', 'ai': '30'}], [[['3103', '00012A']], {'error': 'bad-value', 'ai': '3103'}], [[['01', '88338443484420'], ['15', '924591'], ['37', '']], {'error': 'bad-value', 'ai': '37'}], [[['15', '009908'], ['11', '813644']], '#1500990811813644'], [[['3103', '391395'], ['37', '67'], ['17', '083210'], ['00', '300168916917459102']], '#31033913953767#1708321000300168916917459102'], [[['30', ''], ['13', '195409']], {'error': 'bad-value', 'ai': '30'}], [[['01', '21550398685673'], ['15', '789070'], ['13', '754989']], '#01215503986856731578907013754989'], [[['01', '09501101530003'], ['37', '4B']], {'error': 'bad-value', 'ai': '37'}]]]
labels = ["regression: numeric AI set", "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: numeric AI set 0{'ai': '37', 'error': 'bad-value'}{'ai': '37', 'error': 'bad-value'}Passed
repair trap 1{'ai': '3103', 'error': 'bad-value'}{'ai': '3103', 'error': 'bad-value'}Passed
combined fault 2#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392Passed
control 3#400X9B1-1X9--#31037547253031441746#400X9B1-1X9--#31037547253031441746Passed
control 4{'ai': '00', 'error': 'bad-value'}{'ai': '00', 'error': 'bad-value'}Passed
boundary 5{'ai': '30', 'error': 'bad-value'}{'ai': '30', 'error': 'bad-value'}Passed
boundary 6{'ai': '30', 'error': 'bad-value'}{'ai': '30', 'error': 'bad-value'}Passed
control 7{'ai': '37', 'error': 'bad-value'}{'ai': '37', 'error': 'bad-value'}Passed

SHA-256 / 1876b48fa14f06bfcaf22595d001920ad48a25d946c387b77999c0e18dceb712

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

Case digest / ec2e5421256373a2138af65bd2f1f23e169cd984d5aa8cc4809c9f4350d1085e