FA-79601 / Barcode symbology encoding / Open access
Values may contain the FNC1 placeholder · case 01
A serial number containing "#" is decoded as two fields.
ROOT CAUSE
The character check allows "#", which is reserved for FNC1 in this representation.
VERIFIED REPAIR
Exclude "#" from values.
Unsuccessful approach: Allowing spaces admits a character outside the encodable set.
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 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 = [[[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' '], ['11', '530382'], ['13', '963255']], {'error': 'bad-value', 'ai': '10'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' X'], ['17', '240101']], {'error': 'bad-value', 'ai': '10'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['3103', '776538'], ['00', '757471795866766824'], ['400', 'A11XBA '], ['30', '6703']], {'error': 'bad-value', 'ai': '400'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}], [[['30', '8'], ['10', 'L 1']], {'error': 'bad-value', 'ai': '10'}], [[['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'], [[['21', '1A91X1//1CXBCA'], ['10', 'A11X9-C/A-/1#']], {'error': 'bad-value', 'ai': '10'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' X'], ['17', '240101']], {'error': 'bad-value', 'ai': '10'}], [[['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'], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]]]
labels = ["regression: value character 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: value character set 0 | #10AB#1#21X | {'ai': '10', 'error': 'bad-value'} | Failed |
| repair trap 1 | {'ai': '10', 'error': 'bad-value'} | {'ai': '10', 'error': 'bad-value'} | Passed |
| combined fault 2 | #17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392 | #17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392 | Passed |
| control 3 | #400X9B1-1X9--#31037547253031441746 | #400X9B1-1X9--#31037547253031441746 | Passed |
| 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 | #21SN#7 | {'ai': '21', 'error': 'bad-value'} | Failed |
SHA-256 / 47da891609989566842a716af7f96f616e9fb926f819f65534fdb4e124032662
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(32 <= 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 = [[[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' '], ['11', '530382'], ['13', '963255']], {'error': 'bad-value', 'ai': '10'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' X'], ['17', '240101']], {'error': 'bad-value', 'ai': '10'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['3103', '776538'], ['00', '757471795866766824'], ['400', 'A11XBA '], ['30', '6703']], {'error': 'bad-value', 'ai': '400'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}], [[['30', '8'], ['10', 'L 1']], {'error': 'bad-value', 'ai': '10'}], [[['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'], [[['21', '1A91X1//1CXBCA'], ['10', 'A11X9-C/A-/1#']], {'error': 'bad-value', 'ai': '10'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' X'], ['17', '240101']], {'error': 'bad-value', 'ai': '10'}], [[['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'], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]]]
labels = ["regression: value character 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: value character set 0 | {'ai': '10', 'error': 'bad-value'} | {'ai': '10', 'error': 'bad-value'} | Passed |
| repair trap 1 | #10 #1153038213963255 | {'ai': '10', 'error': 'bad-value'} | Failed |
| combined fault 2 | #17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392 | #17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392 | Passed |
| control 3 | #400X9B1-1X9--#31037547253031441746 | #400X9B1-1X9--#31037547253031441746 | Passed |
| 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': '21', 'error': 'bad-value'} | {'ai': '21', 'error': 'bad-value'} | Passed |
SHA-256 / 170cbd360e13cb170ac6bb6610e86ce385d2a281a8ff500cfc1720d610a837c9
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 = [[[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' '], ['11', '530382'], ['13', '963255']], {'error': 'bad-value', 'ai': '10'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' X'], ['17', '240101']], {'error': 'bad-value', 'ai': '10'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['3103', '776538'], ['00', '757471795866766824'], ['400', 'A11XBA '], ['30', '6703']], {'error': 'bad-value', 'ai': '400'}], [[['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'}], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]], [[[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}], [[['30', '8'], ['10', 'L 1']], {'error': 'bad-value', 'ai': '10'}], [[['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'], [[['21', '1A91X1//1CXBCA'], ['10', 'A11X9-C/A-/1#']], {'error': 'bad-value', 'ai': '10'}]], [[[['10', 'AB#1'], ['21', 'X']], {'error': 'bad-value', 'ai': '10'}], [[['10', ' X'], ['17', '240101']], {'error': 'bad-value', 'ai': '10'}], [[['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'], [[['21', 'SN#7']], {'error': 'bad-value', 'ai': '21'}]]]
labels = ["regression: value character 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: value character set 0 | {'ai': '10', 'error': 'bad-value'} | {'ai': '10', 'error': 'bad-value'} | Passed |
| repair trap 1 | {'ai': '10', 'error': 'bad-value'} | {'ai': '10', 'error': 'bad-value'} | Passed |
| combined fault 2 | #17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392 | #17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392 | Passed |
| control 3 | #400X9B1-1X9--#31037547253031441746 | #400X9B1-1X9--#31037547253031441746 | Passed |
| 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': '21', 'error': 'bad-value'} | {'ai': '21', 'error': 'bad-value'} | Passed |
SHA-256 / ea4daa05711f76db091c9e67aac0fe999bde57c3e6d7be3005f273e660e0b663
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.055841+00:00.
Case digest / b3326d8335e4c58bb19375e7f3a9d79fceb1558384e5e8e6bd66dde0f4420540