FAILURE MAP
← Case archive

FA-79581 / Barcode symbology encoding / Open access

GS1-128 ends with a dangling FNC1 · case 01

Batch or serial fields at the end of the label are followed by a separator that decoders report as an empty field.

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

ROOT CAUSE

The last-field exemption for the FNC1 separator is missing.

THE FAILURE

The last-field exemption for the FNC1 separator is missing.

Unsuccessful approach: Skipping only the first field is unrelated to the end-of-data rule.

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', '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:
            out += '#'
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['400', 'X9B1-1X9--'], ['3103', '754725'], ['30', '31441746']], '#400X9B1-1X9--#31037547253031441746'], [[['30', '392'], ['02', '51233118056838'], ['13', '510658'], ['21', '11C']], '#30392#0251233118056838135106582111C'], [[['17', '124248'], ['400', 'BAB1XXX/9BAB1B1XC1BCX'], ['30', '86711'], ['11', '769392']], '#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392'], [[['00', '90045075234391735A']], {'error': 'bad-value', 'ai': '00'}], [[['30', '314304438']], {'error': 'bad-value', 'ai': '30'}], [[['30', '498926295']], {'error': 'bad-value', 'ai': '30'}], [[['37', '9681'], ['37', '30'], ['30', '601935739'], ['30', '135282']], {'error': 'bad-value', 'ai': '30'}], [[['17', '473380'], ['10', 'BX-X/XC99'], ['400', 'CA'], ['10', '20240101']], '#1747338010BX-X/XC99#400CA#1020240101']], [[[['11', '875343'], ['17', '156844'], ['37', '4945']], '#1187534317156844374945'], [[['00', '104157599771802577'], ['15', '680562'], ['00', '446603554682587942'], ['21', 'CXXB1/-/-']], '#00104157599771802577156805620044660355468258794221CXXB1/-/-'], [[['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'}], [[['02', '50315475817306'], ['13', '780102'], ['30', '86357A'], ['21', '-9C/C9BB-']], {'error': 'bad-value', 'ai': '30'}], [[['15', '20240101'], ['01', '50134768665104']], {'error': 'bad-value', 'ai': '15'}], [[['15', '490773'], ['21', 'XC1C9-XBAA-A/99-1-XA']], '#1549077321XC1C9-XBAA-A/99-1-XA']], [[[['30', '7']], '#307'], [[['00', '396652881164804447'], ['37', '013775']], '#0039665288116480444737013775'], [[['10', 'CB/CXC'], ['13', '936022'], ['37', '25']], '#10CB/CXC#139360223725'], [[['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'}], [[['10', '--A-BC911C']], '#10--A-BC911C']], [[[['15', '596808'], ['30', '38241']], '#155968083038241'], [[['21', 'AA'], ['10', '91A/-ABX'], ['00', '345668921311794339'], ['11', '293271']], '#21AA#1091A/-ABX#0034566892131179433911293271'], [[['21', '19XA/XC-/9-9'], ['400', 'B9BC9/X/9AA--X19AB9BAX']], '#2119XA/XC-/9-9#400B9BC9/X/9AA--X19AB9BAX'], [[['15', '60641#'], ['13', '753605']], {'error': 'bad-value', 'ai': '15'}], [[['15', '29986'], ['11', '20240101']], {'error': 'bad-value', 'ai': '15'}], [[['17', ''], ['11', ''], ['13', '934852']], {'error': 'bad-value', 'ai': '17'}], [[['11', '293752']], '#11293752'], [[['02', '63685458581471'], ['21', 'A9-/A1XX']], '#026368545858147121A9-/A1XX']], [[[['30', '670']], '#30670'], [[['21', '/BBA'], ['10', 'AC-']], '#21/BBA#10AC-'], [[['17', '086872'], ['400', '/XXC1B9/']], '#17086872400/XXC1B9/'], [[['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'], [[['11', '798565'], ['21', 'B-X1C/'], ['17', '896229']], '#1179856521B-X1C/#17896229'], [[['15', '092653'], ['10', 'XC//X-AB9X/']], '#1509265310XC//X-AB9X/']]]
labels = ["regression: separator after the last 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 after the last field 0#400X9B1-1X9--#31037547253031441746##400X9B1-1X9--#31037547253031441746Failed
repair trap 1#30392#0251233118056838135106582111C##30392#0251233118056838135106582111CFailed
combined fault 2#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392Passed
control 3{'ai': '00', 'error': 'bad-value'}{'ai': '00', 'error': 'bad-value'}Passed
control 4{'ai': '30', 'error': 'bad-value'}{'ai': '30', '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#1747338010BX-X/XC99#400CA#1020240101##1747338010BX-X/XC99#400CA#1020240101Failed

SHA-256 / c665829ab7b6950da552c4510b7b5f7e9313c12c09551b9f9a61a2006f955891

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', '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 != 0:
            out += '#'
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[['400', 'X9B1-1X9--'], ['3103', '754725'], ['30', '31441746']], '#400X9B1-1X9--#31037547253031441746'], [[['30', '392'], ['02', '51233118056838'], ['13', '510658'], ['21', '11C']], '#30392#0251233118056838135106582111C'], [[['17', '124248'], ['400', 'BAB1XXX/9BAB1B1XC1BCX'], ['30', '86711'], ['11', '769392']], '#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392'], [[['00', '90045075234391735A']], {'error': 'bad-value', 'ai': '00'}], [[['30', '314304438']], {'error': 'bad-value', 'ai': '30'}], [[['30', '498926295']], {'error': 'bad-value', 'ai': '30'}], [[['37', '9681'], ['37', '30'], ['30', '601935739'], ['30', '135282']], {'error': 'bad-value', 'ai': '30'}], [[['17', '473380'], ['10', 'BX-X/XC99'], ['400', 'CA'], ['10', '20240101']], '#1747338010BX-X/XC99#400CA#1020240101']], [[[['11', '875343'], ['17', '156844'], ['37', '4945']], '#1187534317156844374945'], [[['00', '104157599771802577'], ['15', '680562'], ['00', '446603554682587942'], ['21', 'CXXB1/-/-']], '#00104157599771802577156805620044660355468258794221CXXB1/-/-'], [[['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'}], [[['02', '50315475817306'], ['13', '780102'], ['30', '86357A'], ['21', '-9C/C9BB-']], {'error': 'bad-value', 'ai': '30'}], [[['15', '20240101'], ['01', '50134768665104']], {'error': 'bad-value', 'ai': '15'}], [[['15', '490773'], ['21', 'XC1C9-XBAA-A/99-1-XA']], '#1549077321XC1C9-XBAA-A/99-1-XA']], [[[['30', '7']], '#307'], [[['00', '396652881164804447'], ['37', '013775']], '#0039665288116480444737013775'], [[['10', 'CB/CXC'], ['13', '936022'], ['37', '25']], '#10CB/CXC#139360223725'], [[['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'}], [[['10', '--A-BC911C']], '#10--A-BC911C']], [[[['15', '596808'], ['30', '38241']], '#155968083038241'], [[['21', 'AA'], ['10', '91A/-ABX'], ['00', '345668921311794339'], ['11', '293271']], '#21AA#1091A/-ABX#0034566892131179433911293271'], [[['21', '19XA/XC-/9-9'], ['400', 'B9BC9/X/9AA--X19AB9BAX']], '#2119XA/XC-/9-9#400B9BC9/X/9AA--X19AB9BAX'], [[['15', '60641#'], ['13', '753605']], {'error': 'bad-value', 'ai': '15'}], [[['15', '29986'], ['11', '20240101']], {'error': 'bad-value', 'ai': '15'}], [[['17', ''], ['11', ''], ['13', '934852']], {'error': 'bad-value', 'ai': '17'}], [[['11', '293752']], '#11293752'], [[['02', '63685458581471'], ['21', 'A9-/A1XX']], '#026368545858147121A9-/A1XX']], [[[['30', '670']], '#30670'], [[['21', '/BBA'], ['10', 'AC-']], '#21/BBA#10AC-'], [[['17', '086872'], ['400', '/XXC1B9/']], '#17086872400/XXC1B9/'], [[['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'], [[['11', '798565'], ['21', 'B-X1C/'], ['17', '896229']], '#1179856521B-X1C/#17896229'], [[['15', '092653'], ['10', 'XC//X-AB9X/']], '#1509265310XC//X-AB9X/']]]
labels = ["regression: separator after the last 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 after the last field 0#400X9B1-1X9--31037547253031441746##400X9B1-1X9--#31037547253031441746Failed
repair trap 1#303920251233118056838135106582111C##30392#0251233118056838135106582111CFailed
combined fault 2#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392Passed
control 3{'ai': '00', 'error': 'bad-value'}{'ai': '00', 'error': 'bad-value'}Passed
control 4{'ai': '30', 'error': 'bad-value'}{'ai': '30', '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#1747338010BX-X/XC99#400CA#1020240101##1747338010BX-X/XC99#400CA#1020240101Failed

SHA-256 / c54a0a380f945d538125fb6e7a993bb46da6d226d3a9b83e3c6ae8110f3d0486

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

Case digest / 09501de528c3f01ac61f4c5c6e73a2cced65bba5a9345c5a86207248e3dec12f