FAILURE MAP
← Case archive

FA-79656 / Barcode symbology encoding / Open access

Alphanumeric mode accepts lowercase letters · case 01

Lowercase URLs are sized as alphanumeric but the encoder has no values for them.

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

ROOT CAUSE

Characters are upper-cased before the set membership test.

VERIFIED REPAIR

Check the characters exactly against the 45-character set.

Unsuccessful approach: isalnum accepts lowercase and non-ASCII letters.

Case contract

Compute the length in bits of one QR segment: 4-bit mode indicator, a character count indicator whose width depends on mode and version band (1-9, 10-26, 27-40): numeric 10/12/14, alphanumeric 9/11/13, byte 8/16/16, and the data bits: numeric 10 bits per 3 digits plus 4 or 7 for a remainder of 1 or 2, alphanumeric 11 bits per pair plus 6 for a single, byte 8 bits per UTF-8 byte. Alphanumeric allows 0-9 A-Z space $ % * + - . / :. A count that does not fit the indicator is too-long. Errors: version, charset, mode, too-long.

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(mode, data, version):
    if not 1 <= version <= 40:
        return {'error': 'version'}
    band = 0 if version <= 9 else (1 if version <= 26 else 2)
    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
    if mode == 'numeric':
        if not all(c in '0123456789' for c in data):
            return {'error': 'charset'}
        count = len(data)
        bits = 10 * (count // 3) + [0, 4, 7][count % 3]
        cci = [10, 12, 14][band]
    elif mode == 'alnum':
        if not all(c.upper() in ALNUM for c in data):
            return {'error': 'charset'}
        count = len(data)
        bits = 11 * (count // 2) + 6 * (count % 2)
        cci = [9, 11, 13][band]
    elif mode == 'byte':
        count = len(data.encode('utf-8'))
        bits = 8 * count
        cci = [8, 16, 16][band]
    else:
        return {'error': 'mode'}
    if count >= 1 << cci:
        return {'error': 'too-long'}
    return 4 + cci + bits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('alnum', '1+$q2*', 40), {'error': 'charset'}], [('alnum', 'ééA- q', 9), {'error': 'charset'}], [('alnum', 'q .B2%*', 5), {'error': 'charset'}], [('alnum', '-/$é+/%é+', 0), {'error': 'version'}], [('alnum', '-', 1), 19], [('alnum', '%', 1), 19], [('byte', '1€11€é', 40), 108], [('alnum', '/q', 9), {'error': 'charset'}]], [[('alnum', ' Aq%:.', 27), {'error': 'charset'}], [('alnum', '++$:é1*.+', 10), {'error': 'charset'}], [('alnum', '-:q2*-q', 15), {'error': 'charset'}], [('numeric', '053142', 0), {'error': 'version'}], [('numeric', '089405', 10), 36], [('kanji', 'b1ab11', 5), {'error': 'mode'}], [('alnum', '+qB+', 0), {'error': 'version'}], [('alnum', 'Aq ', 5), {'error': 'charset'}]], [[('alnum', 'BA qq/', 1), {'error': 'charset'}], [('alnum', ': q', 15), {'error': 'charset'}], [('alnum', 'ZZq', 1), {'error': 'charset'}], [('numeric', '00575', 9), 31], [('numeric', '37219', 5), 31], [('numeric', '', 40), 18], [('numeric', '716925614701', 5), 54], [('alnum', '*Zq$', 40), {'error': 'charset'}]], [[('alnum', 'B+ +q+B', 26), {'error': 'charset'}], [('alnum', 'B2q*.é.2-', 15), {'error': 'charset'}], [('alnum', '1ZqA-', 1), {'error': 'charset'}], [('byte', 'abbbaaa', 26), 76], [('byte', '€', 41), {'error': 'version'}], [('numeric', '', 0), {'error': 'version'}], [('numeric', '2', 1), 18], [('alnum', 'A+*+Zq1B.', 26), {'error': 'charset'}]], [[('alnum', 'q1 :B.-', 1), {'error': 'charset'}], [('alnum', 'q*/q-é', 9), {'error': 'charset'}], [('alnum', '*/Zq1 %B', 10), {'error': 'charset'}], [('kanji', 'é ba', 40), {'error': 'mode'}], [('kanji', 'éb', 1), {'error': 'mode'}], [('byte', 'a€', 26), 52], [('alnum', '.', 5), 19], [('alnum', '.1q', 5), {'error': 'charset'}]]]
labels = ["regression: alphanumeric 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 fixtureActualExpectedOutcome
regression: alphanumeric character set 050{'error': 'charset'}Failed
repair trap 1{'error': 'charset'}{'error': 'charset'}Passed
combined fault 252{'error': 'charset'}Failed
control 3{'error': 'version'}{'error': 'version'}Passed
control 41919Passed
boundary 51919Passed
boundary 6108108Passed
control 724{'error': 'charset'}Failed

SHA-256 / 973afdb1a448a3c257241a50591eec7557ce9ed3ce1c750fbbcc61bf9b7bb3cd

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(mode, data, version):
    if not 1 <= version <= 40:
        return {'error': 'version'}
    band = 0 if version <= 9 else (1 if version <= 26 else 2)
    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
    if mode == 'numeric':
        if not all(c in '0123456789' for c in data):
            return {'error': 'charset'}
        count = len(data)
        bits = 10 * (count // 3) + [0, 4, 7][count % 3]
        cci = [10, 12, 14][band]
    elif mode == 'alnum':
        if not all(c.isalnum() or c in ' $%*+-./:' for c in data):
            return {'error': 'charset'}
        count = len(data)
        bits = 11 * (count // 2) + 6 * (count % 2)
        cci = [9, 11, 13][band]
    elif mode == 'byte':
        count = len(data.encode('utf-8'))
        bits = 8 * count
        cci = [8, 16, 16][band]
    else:
        return {'error': 'mode'}
    if count >= 1 << cci:
        return {'error': 'too-long'}
    return 4 + cci + bits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('alnum', '1+$q2*', 40), {'error': 'charset'}], [('alnum', 'ééA- q', 9), {'error': 'charset'}], [('alnum', 'q .B2%*', 5), {'error': 'charset'}], [('alnum', '-/$é+/%é+', 0), {'error': 'version'}], [('alnum', '-', 1), 19], [('alnum', '%', 1), 19], [('byte', '1€11€é', 40), 108], [('alnum', '/q', 9), {'error': 'charset'}]], [[('alnum', ' Aq%:.', 27), {'error': 'charset'}], [('alnum', '++$:é1*.+', 10), {'error': 'charset'}], [('alnum', '-:q2*-q', 15), {'error': 'charset'}], [('numeric', '053142', 0), {'error': 'version'}], [('numeric', '089405', 10), 36], [('kanji', 'b1ab11', 5), {'error': 'mode'}], [('alnum', '+qB+', 0), {'error': 'version'}], [('alnum', 'Aq ', 5), {'error': 'charset'}]], [[('alnum', 'BA qq/', 1), {'error': 'charset'}], [('alnum', ': q', 15), {'error': 'charset'}], [('alnum', 'ZZq', 1), {'error': 'charset'}], [('numeric', '00575', 9), 31], [('numeric', '37219', 5), 31], [('numeric', '', 40), 18], [('numeric', '716925614701', 5), 54], [('alnum', '*Zq$', 40), {'error': 'charset'}]], [[('alnum', 'B+ +q+B', 26), {'error': 'charset'}], [('alnum', 'B2q*.é.2-', 15), {'error': 'charset'}], [('alnum', '1ZqA-', 1), {'error': 'charset'}], [('byte', 'abbbaaa', 26), 76], [('byte', '€', 41), {'error': 'version'}], [('numeric', '', 0), {'error': 'version'}], [('numeric', '2', 1), 18], [('alnum', 'A+*+Zq1B.', 26), {'error': 'charset'}]], [[('alnum', 'q1 :B.-', 1), {'error': 'charset'}], [('alnum', 'q*/q-é', 9), {'error': 'charset'}], [('alnum', '*/Zq1 %B', 10), {'error': 'charset'}], [('kanji', 'é ba', 40), {'error': 'mode'}], [('kanji', 'éb', 1), {'error': 'mode'}], [('byte', 'a€', 26), 52], [('alnum', '.', 5), 19], [('alnum', '.1q', 5), {'error': 'charset'}]]]
labels = ["regression: alphanumeric 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 fixtureActualExpectedOutcome
regression: alphanumeric character set 050{'error': 'charset'}Failed
repair trap 146{'error': 'charset'}Failed
combined fault 252{'error': 'charset'}Failed
control 3{'error': 'version'}{'error': 'version'}Passed
control 41919Passed
boundary 51919Passed
boundary 6108108Passed
control 724{'error': 'charset'}Failed

SHA-256 / 59e26d260fce20150b7b6e30430ac6006dbb9bae4fbe2889536951b52145bd7f

3 / The verified repair

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

N = 1
observations = []
def solve(mode, data, version):
    if not 1 <= version <= 40:
        return {'error': 'version'}
    band = 0 if version <= 9 else (1 if version <= 26 else 2)
    ALNUM = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:'
    if mode == 'numeric':
        if not all(c in '0123456789' for c in data):
            return {'error': 'charset'}
        count = len(data)
        bits = 10 * (count // 3) + [0, 4, 7][count % 3]
        cci = [10, 12, 14][band]
    elif mode == 'alnum':
        if not all(c in ALNUM for c in data):
            return {'error': 'charset'}
        count = len(data)
        bits = 11 * (count // 2) + 6 * (count % 2)
        cci = [9, 11, 13][band]
    elif mode == 'byte':
        count = len(data.encode('utf-8'))
        bits = 8 * count
        cci = [8, 16, 16][band]
    else:
        return {'error': 'mode'}
    if count >= 1 << cci:
        return {'error': 'too-long'}
    return 4 + cci + bits
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('alnum', '1+$q2*', 40), {'error': 'charset'}], [('alnum', 'ééA- q', 9), {'error': 'charset'}], [('alnum', 'q .B2%*', 5), {'error': 'charset'}], [('alnum', '-/$é+/%é+', 0), {'error': 'version'}], [('alnum', '-', 1), 19], [('alnum', '%', 1), 19], [('byte', '1€11€é', 40), 108], [('alnum', '/q', 9), {'error': 'charset'}]], [[('alnum', ' Aq%:.', 27), {'error': 'charset'}], [('alnum', '++$:é1*.+', 10), {'error': 'charset'}], [('alnum', '-:q2*-q', 15), {'error': 'charset'}], [('numeric', '053142', 0), {'error': 'version'}], [('numeric', '089405', 10), 36], [('kanji', 'b1ab11', 5), {'error': 'mode'}], [('alnum', '+qB+', 0), {'error': 'version'}], [('alnum', 'Aq ', 5), {'error': 'charset'}]], [[('alnum', 'BA qq/', 1), {'error': 'charset'}], [('alnum', ': q', 15), {'error': 'charset'}], [('alnum', 'ZZq', 1), {'error': 'charset'}], [('numeric', '00575', 9), 31], [('numeric', '37219', 5), 31], [('numeric', '', 40), 18], [('numeric', '716925614701', 5), 54], [('alnum', '*Zq$', 40), {'error': 'charset'}]], [[('alnum', 'B+ +q+B', 26), {'error': 'charset'}], [('alnum', 'B2q*.é.2-', 15), {'error': 'charset'}], [('alnum', '1ZqA-', 1), {'error': 'charset'}], [('byte', 'abbbaaa', 26), 76], [('byte', '€', 41), {'error': 'version'}], [('numeric', '', 0), {'error': 'version'}], [('numeric', '2', 1), 18], [('alnum', 'A+*+Zq1B.', 26), {'error': 'charset'}]], [[('alnum', 'q1 :B.-', 1), {'error': 'charset'}], [('alnum', 'q*/q-é', 9), {'error': 'charset'}], [('alnum', '*/Zq1 %B', 10), {'error': 'charset'}], [('kanji', 'é ba', 40), {'error': 'mode'}], [('kanji', 'éb', 1), {'error': 'mode'}], [('byte', 'a€', 26), 52], [('alnum', '.', 5), 19], [('alnum', '.1q', 5), {'error': 'charset'}]]]
labels = ["regression: alphanumeric 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 fixtureActualExpectedOutcome
regression: alphanumeric character set 0{'error': 'charset'}{'error': 'charset'}Passed
repair trap 1{'error': 'charset'}{'error': 'charset'}Passed
combined fault 2{'error': 'charset'}{'error': 'charset'}Passed
control 3{'error': 'version'}{'error': 'version'}Passed
control 41919Passed
boundary 51919Passed
boundary 6108108Passed
control 7{'error': 'charset'}{'error': 'charset'}Passed

SHA-256 / f6f5b17282ccc43548dd49aff9effae23d9850f0be2867c06dbe0fc5b4483bea

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

Case digest / 00c7b5b21cd8c2140623440f77eb6ac4602c081ce51287cd06cccd6ee61c3f4f