FAILURE MAP
← Case archive

FA-79551 / Barcode symbology encoding / Open access

Codabar accepts lowercase start and stop letters · case 01

Symbols framed with lowercase letters are passed to a font that has no glyphs for them.

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

ROOT CAUSE

Start/stop characters are upper-cased before validation.

VERIFIED REPAIR

Accept only uppercase A-D as start/stop characters.

Unsuccessful approach: Admitting the alternate T N * E notation violates the A-D contract.

Case contract

Validate and size a Codabar symbol text with a wide:narrow ratio between 2 and 3 inclusive. The first and last characters must be start/stop letters A-D (uppercase only, at least two characters); body characters are 0-9 - $ : / . +. Each character has 7 elements: digits, "-" and "$" have 2 wide elements, ": / . +" and A-D have 3. One narrow gap separates adjacent characters. Return the total width in narrow modules or an error.

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(text, ratio):
    if not 2 <= ratio <= 3:
        return {'error': 'ratio'}
    if len(text) < 2:
        return {'error': 'short'}
    if text[0].upper() not in 'ABCD' or text[-1].upper() not in 'ABCD':
        return {'error': 'start-stop'}
    body = text[1:-1]
    for ch in body:
        if ch not in '0123456789-$:/.+':
            return {'error': 'char', 'char': ch}
    total = 0
    for ch in text:
        wides = 2 if ch in '0123456789-$' else 3
        total += (7 - wides) + wides * ratio
    return {'modules': total + len(text) - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('a+d', 2.5), {'error': 'start-stop'}], [('A+53T', 3), {'error': 'start-stop'}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('C5525D', 1.5), {'error': 'ratio'}], [('D$554A', 4), {'error': 'ratio'}], [('C+B', 3), {'modules': 41}], [('ad', 3), {'error': 'start-stop'}]], [[('a3/AC', 3), {'error': 'start-stop'}], [('BT', 3), {'error': 'start-stop'}], [('a$5D', 1.5), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('AAA$03d', 4), {'error': 'ratio'}], [('C773C', 1.5), {'error': 'ratio'}], [('a2$A', 1.5), {'error': 'ratio'}], [('BE3Ed', 2.5), {'error': 'start-stop'}]], [[('B55d', 2.5), {'error': 'start-stop'}], [('C35355T', 3), {'error': 'start-stop'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('a6C', 4), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}]], [[('a2/C', 2), {'error': 'start-stop'}], [('A3AA+3T', 2.5), {'error': 'start-stop'}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A:5B', 2), {'modules': 42}], [('C528+D', 2), {'modules': 62}], [('D3$20d', 3), {'error': 'start-stop'}]], [[('a/D', 3), {'error': 'start-stop'}], [('A9T', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('A-$1A', 3), {'modules': 63}], [('A035/$C', 1.5), {'error': 'ratio'}], [('C55-T', 4), {'error': 'ratio'}], [('a/803T', 3), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}]]]
labels = ["regression: start and stop letters", "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: start and stop letters 0{'modules': 36.5}{'error': 'start-stop'}Failed
repair trap 1{'error': 'start-stop'}{'error': 'start-stop'}Passed
combined fault 2{'char': 'A', 'error': 'char'}{'char': 'A', 'error': 'char'}Passed
control 3{'char': 'E', 'error': 'char'}{'char': 'E', 'error': 'char'}Passed
control 4{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 5{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 6{'modules': 41}{'modules': 41}Passed
control 7{'modules': 27}{'error': 'start-stop'}Failed

SHA-256 / 2c301c4066a2a19029eea338841610fa3b13cfd9a9301d12730a19739976fa06

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(text, ratio):
    if not 2 <= ratio <= 3:
        return {'error': 'ratio'}
    if len(text) < 2:
        return {'error': 'short'}
    if text[0] not in 'ABCDTN*E' or text[-1] not in 'ABCDTN*E':
        return {'error': 'start-stop'}
    body = text[1:-1]
    for ch in body:
        if ch not in '0123456789-$:/.+':
            return {'error': 'char', 'char': ch}
    total = 0
    for ch in text:
        wides = 2 if ch in '0123456789-$' else 3
        total += (7 - wides) + wides * ratio
    return {'modules': total + len(text) - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('a+d', 2.5), {'error': 'start-stop'}], [('A+53T', 3), {'error': 'start-stop'}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('C5525D', 1.5), {'error': 'ratio'}], [('D$554A', 4), {'error': 'ratio'}], [('C+B', 3), {'modules': 41}], [('ad', 3), {'error': 'start-stop'}]], [[('a3/AC', 3), {'error': 'start-stop'}], [('BT', 3), {'error': 'start-stop'}], [('a$5D', 1.5), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('AAA$03d', 4), {'error': 'ratio'}], [('C773C', 1.5), {'error': 'ratio'}], [('a2$A', 1.5), {'error': 'ratio'}], [('BE3Ed', 2.5), {'error': 'start-stop'}]], [[('B55d', 2.5), {'error': 'start-stop'}], [('C35355T', 3), {'error': 'start-stop'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('a6C', 4), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}]], [[('a2/C', 2), {'error': 'start-stop'}], [('A3AA+3T', 2.5), {'error': 'start-stop'}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A:5B', 2), {'modules': 42}], [('C528+D', 2), {'modules': 62}], [('D3$20d', 3), {'error': 'start-stop'}]], [[('a/D', 3), {'error': 'start-stop'}], [('A9T', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('A-$1A', 3), {'modules': 63}], [('A035/$C', 1.5), {'error': 'ratio'}], [('C55-T', 4), {'error': 'ratio'}], [('a/803T', 3), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}]]]
labels = ["regression: start and stop letters", "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: start and stop letters 0{'error': 'start-stop'}{'error': 'start-stop'}Passed
repair trap 1{'modules': 65}{'error': 'start-stop'}Failed
combined fault 2{'char': 'A', 'error': 'char'}{'char': 'A', 'error': 'char'}Passed
control 3{'char': 'E', 'error': 'char'}{'char': 'E', 'error': 'char'}Passed
control 4{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 5{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 6{'modules': 41}{'modules': 41}Passed
control 7{'error': 'start-stop'}{'error': 'start-stop'}Passed

SHA-256 / caa45c1cc3a09b643e0a0b1ecaef0f34f68bdc31882896aba6602750995eec7e

3 / The verified repair

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

N = 1
observations = []
def solve(text, ratio):
    if not 2 <= ratio <= 3:
        return {'error': 'ratio'}
    if len(text) < 2:
        return {'error': 'short'}
    if text[0] not in 'ABCD' or text[-1] not in 'ABCD':
        return {'error': 'start-stop'}
    body = text[1:-1]
    for ch in body:
        if ch not in '0123456789-$:/.+':
            return {'error': 'char', 'char': ch}
    total = 0
    for ch in text:
        wides = 2 if ch in '0123456789-$' else 3
        total += (7 - wides) + wides * ratio
    return {'modules': total + len(text) - 1}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[('a+d', 2.5), {'error': 'start-stop'}], [('A+53T', 3), {'error': 'start-stop'}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('C5525D', 1.5), {'error': 'ratio'}], [('D$554A', 4), {'error': 'ratio'}], [('C+B', 3), {'modules': 41}], [('ad', 3), {'error': 'start-stop'}]], [[('a3/AC', 3), {'error': 'start-stop'}], [('BT', 3), {'error': 'start-stop'}], [('a$5D', 1.5), {'error': 'ratio'}], [('CD', 2), {'modules': 21}], [('AAA$03d', 4), {'error': 'ratio'}], [('C773C', 1.5), {'error': 'ratio'}], [('a2$A', 1.5), {'error': 'ratio'}], [('BE3Ed', 2.5), {'error': 'start-stop'}]], [[('B55d', 2.5), {'error': 'start-stop'}], [('C35355T', 3), {'error': 'start-stop'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('a6C', 4), {'error': 'ratio'}], [('a5C', 2), {'error': 'start-stop'}]], [[('a2/C', 2), {'error': 'start-stop'}], [('A3AA+3T', 2.5), {'error': 'start-stop'}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('aT', 2.5), {'error': 'start-stop'}], [('A:5B', 2), {'modules': 42}], [('C528+D', 2), {'modules': 62}], [('D3$20d', 3), {'error': 'start-stop'}]], [[('a/D', 3), {'error': 'start-stop'}], [('A9T', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('A-$1A', 3), {'modules': 63}], [('A035/$C', 1.5), {'error': 'ratio'}], [('C55-T', 4), {'error': 'ratio'}], [('a/803T', 3), {'error': 'start-stop'}], [('A97+$5d', 2.5), {'error': 'start-stop'}]]]
labels = ["regression: start and stop letters", "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: start and stop letters 0{'error': 'start-stop'}{'error': 'start-stop'}Passed
repair trap 1{'error': 'start-stop'}{'error': 'start-stop'}Passed
combined fault 2{'char': 'A', 'error': 'char'}{'char': 'A', 'error': 'char'}Passed
control 3{'char': 'E', 'error': 'char'}{'char': 'E', 'error': 'char'}Passed
control 4{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 5{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 6{'modules': 41}{'modules': 41}Passed
control 7{'error': 'start-stop'}{'error': 'start-stop'}Passed

SHA-256 / 11e051797ecb47429010837444f20a3fd620b565a3e4c64f782fb39525e04d13

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

Case digest / a8039f90cfd3b127359294b653189a7a61a359874e77286f13da2fe65949830e