{"abstract":"A missing separator after AI 30 merges the next field into the count without an error.","category":"Barcode symbology encoding","checks":8,"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.","contract_signature":"s","evaluation_group":"w2-barcode-symbology-encoding-gs1-scan-parse","failed_approach":"A global maximum of 20 is wrong for AIs 30, 37 and 400.","family":"w2-barcode-symbology-encoding-gs1-scan-parse-variable-max","id":"FA-79621","implementations":{"attempt":{"sha256":"7c54bdc18e9031a5115b35b3250b706a19a7d5b4bce335d8872e420c365de52d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\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    if not s.startswith(']C1'):\n        return {'error': 'not-gs1'}\n    i = 3\n    out = []\n    while i < len(s):\n        if s[i] == '\\x1d':\n            i += 1\n            continue\n        ai = None\n        for L in (2, 3, 4):\n            if s[i:i + L] in fixed_len or s[i:i + L] in var_max:\n                ai = s[i:i + L]\n                break\n        if ai is None:\n            return {'error': 'unknown-ai', 'at': i}\n        i += len(ai)\n        if ai in fixed_len:\n            n = fixed_len[ai]\n            val = s[i:i + n]\n            if len(val) != n or '\\x1d' in val:\n                return {'error': 'short', 'ai': ai}\n            i += n\n        else:\n            j = s.find('\\x1d', i)\n            if j == -1:\n                j = len(s)\n            val = s[i:j]\n            if not 1 <= len(val) <= 20:\n                return {'error': 'length', 'ai': ai}\n            i = j\n        out.append([ai, val])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[']C137244121375\\x1d21\\x1d400XAXCC9C/XXB/1\\x1d10/CA', {'error': 'length', 'ai': '37'}], [']C121/9A9-BBAXB9/1CX11A\\x1d370168\\x1d400XXXXACBAC1A99XX\\x1d37958407873', {'error': 'length', 'ai': '37'}], [']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'}], [']C121AC1CXBXC//BB1BCB\\x1d310327866137162541688\\x1d371', {'error': 'length', 'ai': '37'}]], [[']C12191XXAXB/XX-B91A9-1X1A\\x1d10CBAB1-B', {'error': 'length', 'ai': '21'}], [']C13103253004017432790047008137876520261\\x1d', {'error': 'length', 'ai': '37'}], [']C13076330559\\x1d017350710908563810CX/1/1X//XX//AXCBA-\\x1d30467914952', {'error': 'length', 'ai': '30'}], [']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/']]], [']C137791221293\\x1d400A11/1/ACC///CXC1CA/X-\\x1d400A-/\\x1d37768579', {'error': 'length', 'ai': '37'}]], [[']C121CX1CBA11//99A\\x1d018138092042504821XCAA9BX9C91BXBX--B1B-\\x1d3103153253', {'error': 'length', 'ai': '21'}], [']C1370404\\x1d0169587500743493400C-B1-BAAC9AXXCXAA/B1X\\x1d', [['37', '0404'], ['01', '69587500743493'], ['400', 'C-B1-BAAC9AXXCXAA/B1X']]], [']C137364\\x1d37951579975\\x1d11440863\\x1d37038364119\\x1d', {'error': 'length', 'ai': '37'}], [']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']]], [']C111990558117862\\x1d10X-11\\x1d0141668383672539', {'error': 'short', 'ai': '11'}], [']C10011511945802272876110ABXB-BA1-B/1X1-BBCXCX1\\x1d0143358957494055', {'error': 'length', 'ai': '10'}]], [[']C10153009609031376219XBB-1C-1A9//\\x1d1781184810CB9CX-AX--B9ABCCBB9X-C\\x1d', {'error': 'length', 'ai': '10'}], [']C121AB/-C9A99/\\x1d305405245\\x1d00419461779691996360400-1XBCX9CCA9/A-9-1C-11C\\x1d', [['21', 'AB/-C9A99/'], ['30', '5405245'], ['00', '419461779691996360'], ['400', '-1XBCX9CCA9/A-9-1C-11C']]], [']C111141665\\x1d37247204674\\x1d37790824985\\x1d00445616335895473473', {'error': 'length', 'ai': '37'}], [']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'}], [']C1211\\x1d37789365790\\x1d30311652\\x1d', {'error': 'length', 'ai': '37'}]], [[']C13066\\x1d37793432856\\x1d3097076472', {'error': 'length', 'ai': '37'}], [']C137505172476\\x1d3103210156', {'error': 'length', 'ai': '37'}], [']C137335719723\\x1d', {'error': 'length', 'ai': '37'}], [']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'}], [']C121-X-BCCC/AB/11/XX-C-B1A\\x1d310310809321XX9-CB/X/XAB1XXC', {'error': 'length', 'ai': '21'}]]]\nlabels = [\"regression: variable field maximum\", \"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":"360dc706483187442bcdc529484e1051ade994937af2dd6b15af950d8adc9618","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\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    if not s.startswith(']C1'):\n        return {'error': 'not-gs1'}\n    i = 3\n    out = []\n    while i < len(s):\n        if s[i] == '\\x1d':\n            i += 1\n            continue\n        ai = None\n        for L in (2, 3, 4):\n            if s[i:i + L] in fixed_len or s[i:i + L] in var_max:\n                ai = s[i:i + L]\n                break\n        if ai is None:\n            return {'error': 'unknown-ai', 'at': i}\n        i += len(ai)\n        if ai in fixed_len:\n            n = fixed_len[ai]\n            val = s[i:i + n]\n            if len(val) != n or '\\x1d' in val:\n                return {'error': 'short', 'ai': ai}\n            i += n\n        else:\n            j = s.find('\\x1d', i)\n            if j == -1:\n                j = len(s)\n            val = s[i:j]\n            if len(val) < 1:\n                return {'error': 'length', 'ai': ai}\n            i = j\n        out.append([ai, val])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[']C137244121375\\x1d21\\x1d400XAXCC9C/XXB/1\\x1d10/CA', {'error': 'length', 'ai': '37'}], [']C121/9A9-BBAXB9/1CX11A\\x1d370168\\x1d400XXXXACBAC1A99XX\\x1d37958407873', {'error': 'length', 'ai': '37'}], [']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'}], [']C121AC1CXBXC//BB1BCB\\x1d310327866137162541688\\x1d371', {'error': 'length', 'ai': '37'}]], [[']C12191XXAXB/XX-B91A9-1X1A\\x1d10CBAB1-B', {'error': 'length', 'ai': '21'}], [']C13103253004017432790047008137876520261\\x1d', {'error': 'length', 'ai': '37'}], [']C13076330559\\x1d017350710908563810CX/1/1X//XX//AXCBA-\\x1d30467914952', {'error': 'length', 'ai': '30'}], [']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/']]], [']C137791221293\\x1d400A11/1/ACC///CXC1CA/X-\\x1d400A-/\\x1d37768579', {'error': 'length', 'ai': '37'}]], [[']C121CX1CBA11//99A\\x1d018138092042504821XCAA9BX9C91BXBX--B1B-\\x1d3103153253', {'error': 'length', 'ai': '21'}], [']C1370404\\x1d0169587500743493400C-B1-BAAC9AXXCXAA/B1X\\x1d', [['37', '0404'], ['01', '69587500743493'], ['400', 'C-B1-BAAC9AXXCXAA/B1X']]], [']C137364\\x1d37951579975\\x1d11440863\\x1d37038364119\\x1d', {'error': 'length', 'ai': '37'}], [']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']]], [']C111990558117862\\x1d10X-11\\x1d0141668383672539', {'error': 'short', 'ai': '11'}], [']C10011511945802272876110ABXB-BA1-B/1X1-BBCXCX1\\x1d0143358957494055', {'error': 'length', 'ai': '10'}]], [[']C10153009609031376219XBB-1C-1A9//\\x1d1781184810CB9CX-AX--B9ABCCBB9X-C\\x1d', {'error': 'length', 'ai': '10'}], [']C121AB/-C9A99/\\x1d305405245\\x1d00419461779691996360400-1XBCX9CCA9/A-9-1C-11C\\x1d', [['21', 'AB/-C9A99/'], ['30', '5405245'], ['00', '419461779691996360'], ['400', '-1XBCX9CCA9/A-9-1C-11C']]], [']C111141665\\x1d37247204674\\x1d37790824985\\x1d00445616335895473473', {'error': 'length', 'ai': '37'}], [']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'}], [']C1211\\x1d37789365790\\x1d30311652\\x1d', {'error': 'length', 'ai': '37'}]], [[']C13066\\x1d37793432856\\x1d3097076472', {'error': 'length', 'ai': '37'}], [']C137505172476\\x1d3103210156', {'error': 'length', 'ai': '37'}], [']C137335719723\\x1d', {'error': 'length', 'ai': '37'}], [']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'}], [']C121-X-BCCC/AB/11/XX-C-B1A\\x1d310310809321XX9-CB/X/XAB1XXC', {'error': 'length', 'ai': '21'}]]]\nlabels = [\"regression: variable field maximum\", \"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-scan-parse-variable-max","generated_at":"2026-09-29T14:49:46.299101+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":"Variable fields have no maximum length check.","sha256":"46864fb3d3290f3a460e384644a31570eb9efb000af88439087350db41827497","title":"Over-long count field is accepted · 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":41.376,"exit_code":1,"observations":[{"actual":{"ai":"21","error":"length"},"check":"regression: variable field maximum 0","expected":{"ai":"37","error":"length"},"passed":false},{"actual":[["21","/9A9-BBAXB9/1CX11A"],["37","0168"],["400","XXXXACBAC1A99XX"],["37","958407873"]],"check":"repair trap 1","expected":{"ai":"37","error":"length"},"passed":false},{"actual":{"error":"not-gs1"},"check":"combined fault 2","expected":{"error":"not-gs1"},"passed":true},{"actual":{"error":"not-gs1"},"check":"control 3","expected":{"error":"not-gs1"},"passed":true},{"actual":[["17","140648"],["30","6"],["01","41294680397442"]],"check":"control 4","expected":[["17","140648"],["30","6"],["01","41294680397442"]],"passed":true},{"actual":{"error":"not-gs1"},"check":"boundary 5","expected":{"error":"not-gs1"},"passed":true},{"actual":{"error":"not-gs1"},"check":"boundary 6","expected":{"error":"not-gs1"},"passed":true},{"actual":[["21","AC1CXBXC//BB1BCB"],["3103","278661"],["37","162541688"],["37","1"]],"check":"control 7","expected":{"ai":"37","error":"length"},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: variable field maximum 0\", \"actual\": {\"error\": \"length\", \"ai\": \"21\"}, \"expected\": {\"error\": \"length\", \"ai\": \"37\"}, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [[\"21\", \"/9A9-BBAXB9/1CX11A\"], [\"37\", \"0168\"], [\"400\", \"XXXXACBAC1A99XX\"], [\"37\", \"958407873\"]], \"expected\": {\"error\": \"length\", \"ai\": \"37\"}, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": {\"error\": \"not-gs1\"}, \"expected\": {\"error\": \"not-gs1\"}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"not-gs1\"}, \"expected\": {\"error\": \"not-gs1\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": [[\"17\", \"140648\"], [\"30\", \"6\"], [\"01\", \"41294680397442\"]], \"expected\": [[\"17\", \"140648\"], [\"30\", \"6\"], [\"01\", \"41294680397442\"]], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": {\"error\": \"not-gs1\"}, \"expected\": {\"error\": \"not-gs1\"}, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"not-gs1\"}, \"expected\": {\"error\": \"not-gs1\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": [[\"21\", \"AC1CXBXC//BB1BCB\"], [\"3103\", \"278661\"], [\"37\", \"162541688\"], [\"37\", \"1\"]], \"expected\": {\"error\": \"length\", \"ai\": \"37\"}, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.035,"exit_code":1,"observations":[{"actual":{"ai":"21","error":"length"},"check":"regression: variable field maximum 0","expected":{"ai":"37","error":"length"},"passed":false},{"actual":[["21","/9A9-BBAXB9/1CX11A"],["37","0168"],["400","XXXXACBAC1A99XX"],["37","958407873"]],"check":"repair trap 1","expected":{"ai":"37","error":"length"},"passed":false},{"actual":{"error":"not-gs1"},"check":"combined fault 2","expected":{"error":"not-gs1"},"passed":true},{"actual":{"error":"not-gs1"},"check":"control 3","expected":{"error":"not-gs1"},"passed":true},{"actual":[["17","140648"],["30","6"],["01","41294680397442"]],"check":"control 4","expected":[["17","140648"],["30","6"],["01","41294680397442"]],"passed":true},{"actual":{"error":"not-gs1"},"check":"boundary 5","expected":{"error":"not-gs1"},"passed":true},{"actual":{"error":"not-gs1"},"check":"boundary 6","expected":{"error":"not-gs1"},"passed":true},{"actual":[["21","AC1CXBXC//BB1BCB"],["3103","278661"],["37","162541688"],["37","1"]],"check":"control 7","expected":{"ai":"37","error":"length"},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: variable field maximum 0\", \"actual\": {\"error\": \"length\", \"ai\": \"21\"}, \"expected\": {\"error\": \"length\", \"ai\": \"37\"}, \"passed\": false}, {\"check\": \"repair trap 1\", \"actual\": [[\"21\", \"/9A9-BBAXB9/1CX11A\"], [\"37\", \"0168\"], [\"400\", \"XXXXACBAC1A99XX\"], [\"37\", \"958407873\"]], \"expected\": {\"error\": \"length\", \"ai\": \"37\"}, \"passed\": false}, {\"check\": \"combined fault 2\", \"actual\": {\"error\": \"not-gs1\"}, \"expected\": {\"error\": \"not-gs1\"}, \"passed\": true}, {\"check\": \"control 3\", \"actual\": {\"error\": \"not-gs1\"}, \"expected\": {\"error\": \"not-gs1\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": [[\"17\", \"140648\"], [\"30\", \"6\"], [\"01\", \"41294680397442\"]], \"expected\": [[\"17\", \"140648\"], [\"30\", \"6\"], [\"01\", \"41294680397442\"]], \"passed\": true}, {\"check\": \"boundary 5\", \"actual\": {\"error\": \"not-gs1\"}, \"expected\": {\"error\": \"not-gs1\"}, \"passed\": true}, {\"check\": \"boundary 6\", \"actual\": {\"error\": \"not-gs1\"}, \"expected\": {\"error\": \"not-gs1\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": [[\"21\", \"AC1CXBXC//BB1BCB\"], [\"3103\", \"278661\"], [\"37\", \"162541688\"], [\"37\", \"1\"]], \"expected\": {\"error\": \"length\", \"ai\": \"37\"}, \"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."}}