{"abstract":"A serial number containing \"#\" is decoded as two fields.","category":"Barcode symbology encoding","checks":8,"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.","contract_signature":"fields","evaluation_group":"w2-barcode-symbology-encoding-gs1-128-assembly","failed_approach":"Allowing spaces admits a character outside the encodable set.","family":"w2-barcode-symbology-encoding-gs1-128-assembly-charset","id":"FA-79601","implementations":{"attempt":{"sha256":"170cbd360e13cb170ac6bb6610e86ce385d2a281a8ff500cfc1720d610a837c9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(fields):\n    fixed_len = {'00': 18, '01': 14, '02': 14, '11': 6, '13': 6, '15': 6, '17': 6, '3103': 6}\n    var_max = {'10': 20, '21': 20, '30': 8, '37': 8, '400': 30}\n    numeric = {'00', '01', '02', '11', '13', '15', '17', '3103', '30', '37'}\n    out = '#'\n    for idx, (ai, val) in enumerate(fields):\n        if ai in fixed_len:\n            if len(val) != fixed_len[ai]:\n                return {'error': 'bad-value', 'ai': ai}\n        elif ai in var_max:\n            if not 1 <= len(val) <= var_max[ai]:\n                return {'error': 'bad-value', 'ai': ai}\n        else:\n            return {'error': 'unknown-ai', 'ai': ai}\n        if ai in numeric and not all(c in '0123456789' for c in val):\n            return {'error': 'bad-value', 'ai': ai}\n        if not all(32 <= ord(c) <= 126 and c != '#' for c in val):\n            return {'error': 'bad-value', 'ai': ai}\n        out += ai + val\n        if ai in var_max and idx < len(fields) - 1:\n            out += '#'\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[['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'}]]]\nlabels = [\"regression: value character set\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"47da891609989566842a716af7f96f616e9fb926f819f65534fdb4e124032662","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(fields):\n    fixed_len = {'00': 18, '01': 14, '02': 14, '11': 6, '13': 6, '15': 6, '17': 6, '3103': 6}\n    var_max = {'10': 20, '21': 20, '30': 8, '37': 8, '400': 30}\n    numeric = {'00', '01', '02', '11', '13', '15', '17', '3103', '30', '37'}\n    out = '#'\n    for idx, (ai, val) in enumerate(fields):\n        if ai in fixed_len:\n            if len(val) != fixed_len[ai]:\n                return {'error': 'bad-value', 'ai': ai}\n        elif ai in var_max:\n            if not 1 <= len(val) <= var_max[ai]:\n                return {'error': 'bad-value', 'ai': ai}\n        else:\n            return {'error': 'unknown-ai', 'ai': ai}\n        if ai in numeric and not all(c in '0123456789' for c in val):\n            return {'error': 'bad-value', 'ai': ai}\n        if not all(33 <= ord(c) <= 126 for c in val):\n            return {'error': 'bad-value', 'ai': ai}\n        out += ai + val\n        if ai in var_max and idx < len(fields) - 1:\n            out += '#'\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[['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'}]]]\nlabels = [\"regression: value character set\", \"repair trap\", \"combined fault\", \"control\", \"control\", \"boundary\", \"boundary\", \"control\"]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (labels[i % len(labels)], i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-barcode-symbology-encoding-gs1-128-assembly-charset","generated_at":"2026-09-29T14:49:46.055841+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"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.","root_cause":"The character check allows \"#\", which is reserved for FNC1 in this representation.","sha256":"1aab446610d8d9eaba4df26504e5eb95f9c03a64f6776e3ca6121a99c751c965","title":"Values may contain the FNC1 placeholder · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.049,"exit_code":1,"observations":[{"actual":{"ai":"10","error":"bad-value"},"check":"regression: value character set 0","expected":{"ai":"10","error":"bad-value"},"passed":true},{"actual":"#10 #1153038213963255","check":"repair trap 1","expected":{"ai":"10","error":"bad-value"},"passed":false},{"actual":"#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392","check":"combined fault 2","expected":"#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392","passed":true},{"actual":"#400X9B1-1X9--#31037547253031441746","check":"control 3","expected":"#400X9B1-1X9--#31037547253031441746","passed":true},{"actual":{"ai":"00","error":"bad-value"},"check":"control 4","expected":{"ai":"00","error":"bad-value"},"passed":true},{"actual":{"ai":"30","error":"bad-value"},"check":"boundary 5","expected":{"ai":"30","error":"bad-value"},"passed":true},{"actual":{"ai":"30","error":"bad-value"},"check":"boundary 6","expected":{"ai":"30","error":"bad-value"},"passed":true},{"actual":{"ai":"21","error":"bad-value"},"check":"control 7","expected":{"ai":"21","error":"bad-value"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: value character set 0\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"10\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"10\"}, \"passed\": true}, {\"check\": \"repair trap 1\", \"actual\": \"#10 #1153038213963255\", \"expected\": {\"error\": \"bad-value\", \"ai\": \"10\"}, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": \"#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392\", \"expected\": \"#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"#400X9B1-1X9--#31037547253031441746\", \"expected\": \"#400X9B1-1X9--#31037547253031441746\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"00\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"00\"}, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"30\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"30\"}, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"30\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"30\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"21\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"21\"}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":37.586,"exit_code":1,"observations":[{"actual":"#10AB#1#21X","check":"regression: value character set 0","expected":{"ai":"10","error":"bad-value"},"passed":false},{"actual":{"ai":"10","error":"bad-value"},"check":"repair trap 1","expected":{"ai":"10","error":"bad-value"},"passed":true},{"actual":"#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392","check":"combined fault 2","expected":"#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392","passed":true},{"actual":"#400X9B1-1X9--#31037547253031441746","check":"control 3","expected":"#400X9B1-1X9--#31037547253031441746","passed":true},{"actual":{"ai":"00","error":"bad-value"},"check":"control 4","expected":{"ai":"00","error":"bad-value"},"passed":true},{"actual":{"ai":"30","error":"bad-value"},"check":"boundary 5","expected":{"ai":"30","error":"bad-value"},"passed":true},{"actual":{"ai":"30","error":"bad-value"},"check":"boundary 6","expected":{"ai":"30","error":"bad-value"},"passed":true},{"actual":"#21SN#7","check":"control 7","expected":{"ai":"21","error":"bad-value"},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: value character set 0\", \"actual\": \"#10AB#1#21X\", \"expected\": {\"error\": \"bad-value\", \"ai\": \"10\"}, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"10\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"10\"}, \"passed\": true}, {\"check\": \"combined fault 2\", \"actual\": \"#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392\", \"expected\": \"#17124248400BAB1XXX/9BAB1B1XC1BCX#3086711#11769392\", \"passed\": true}, {\"check\": \"control 3\", \"actual\": \"#400X9B1-1X9--#31037547253031441746\", \"expected\": \"#400X9B1-1X9--#31037547253031441746\", \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"00\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"00\"}, \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"30\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"30\"}, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"bad-value\", \"ai\": \"30\"}, \"expected\": {\"error\": \"bad-value\", \"ai\": \"30\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": \"#21SN#7\", \"expected\": {\"error\": \"bad-value\", \"ai\": \"21\"}, \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}