FAILURE MAP
← Case archive

FA-79561 / Barcode symbology encoding / Open access

Codabar rejects symbols with an empty body · case 01

A start/stop pair used as a separator label cannot be printed.

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

ROOT CAUSE

At least three characters are required, but start plus stop alone is a valid symbol.

VERIFIED REPAIR

Require at least two characters.

Unsuccessful approach: Allowing one character reuses it as both start and stop.

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) < 3:
        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 = [[[('ad', 3), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('a+d', 2.5), {'error': 'start-stop'}], [('C5525D', 1.5), {'error': 'ratio'}], [('D$554A', 4), {'error': 'ratio'}], [('AA', 3), {'modules': 27}]], [[('CA', 3), {'modules': 27}], [('A', 3), {'error': 'short'}], [('a$5D', 1.5), {'error': 'ratio'}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('BT', 3), {'error': 'start-stop'}]], [[('AT', 2.5), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('BT', 3), {'error': 'start-stop'}]], [[('AB', 2.5), {'modules': 24.0}], [('A', 3), {'error': 'short'}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('A:5B', 2), {'modules': 42}], [('C528+D', 2), {'modules': 62}], [('aB', 2.5), {'error': 'start-stop'}]], [[('Cd', 3), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('A-$1A', 3), {'modules': 63}], [('aB', 3), {'error': 'start-stop'}]]]
labels = ["regression: minimum symbol length", "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: minimum symbol length 0{'error': 'short'}{'error': 'start-stop'}Failed
repair trap 1{'error': 'short'}{'error': 'short'}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': 'start-stop'}{'error': 'start-stop'}Passed
boundary 5{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 6{'error': 'ratio'}{'error': 'ratio'}Passed
control 7{'error': 'short'}{'modules': 27}Failed

SHA-256 / 29ea84ddd0ae4c83829fb693b9ae5d56e3a3ebe57042932a37e93bb93105e3f2

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) < 1:
        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 = [[[('ad', 3), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('a+d', 2.5), {'error': 'start-stop'}], [('C5525D', 1.5), {'error': 'ratio'}], [('D$554A', 4), {'error': 'ratio'}], [('AA', 3), {'modules': 27}]], [[('CA', 3), {'modules': 27}], [('A', 3), {'error': 'short'}], [('a$5D', 1.5), {'error': 'ratio'}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('BT', 3), {'error': 'start-stop'}]], [[('AT', 2.5), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('BT', 3), {'error': 'start-stop'}]], [[('AB', 2.5), {'modules': 24.0}], [('A', 3), {'error': 'short'}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('A:5B', 2), {'modules': 42}], [('C528+D', 2), {'modules': 62}], [('aB', 2.5), {'error': 'start-stop'}]], [[('Cd', 3), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('A-$1A', 3), {'modules': 63}], [('aB', 3), {'error': 'start-stop'}]]]
labels = ["regression: minimum symbol length", "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: minimum symbol length 0{'error': 'start-stop'}{'error': 'start-stop'}Passed
repair trap 1{'modules': 13}{'error': 'short'}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': 'start-stop'}{'error': 'start-stop'}Passed
boundary 5{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 6{'error': 'ratio'}{'error': 'ratio'}Passed
control 7{'modules': 27}{'modules': 27}Passed

SHA-256 / 359b1656a91bbe3fe8b8b20b8478d6de64fd31fd2a603ddd820748ebf576dac3

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 = [[[('ad', 3), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('DA/40D', 2.5), {'error': 'char', 'char': 'A'}], [('AE2$5C', 3), {'error': 'char', 'char': 'E'}], [('a+d', 2.5), {'error': 'start-stop'}], [('C5525D', 1.5), {'error': 'ratio'}], [('D$554A', 4), {'error': 'ratio'}], [('AA', 3), {'modules': 27}]], [[('CA', 3), {'modules': 27}], [('A', 3), {'error': 'short'}], [('a$5D', 1.5), {'error': 'ratio'}], [('AAA$03d', 4), {'error': 'ratio'}], [('A+3d', 2), {'error': 'start-stop'}], [('a3/AC', 3), {'error': 'start-stop'}], [('A/59$T', 3), {'error': 'start-stop'}], [('BT', 3), {'error': 'start-stop'}]], [[('AT', 2.5), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('A$7:+d', 1.5), {'error': 'ratio'}], [('a+A', 4), {'error': 'ratio'}], [('A9505D', 2), {'modules': 61}], [('a958$3C', 1.5), {'error': 'ratio'}], [('D5357T', 1.5), {'error': 'ratio'}], [('BT', 3), {'error': 'start-stop'}]], [[('AB', 2.5), {'modules': 24.0}], [('A', 3), {'error': 'short'}], [('D55B', 3), {'modules': 51}], [('B+-+-5B', 1.5), {'error': 'ratio'}], [('A95-42T', 1.5), {'error': 'ratio'}], [('A:5B', 2), {'modules': 42}], [('C528+D', 2), {'modules': 62}], [('aB', 2.5), {'error': 'start-stop'}]], [[('Cd', 3), {'error': 'start-stop'}], [('A', 3), {'error': 'short'}], [('A97+$5d', 2.5), {'error': 'start-stop'}], [('B5C', 3), {'modules': 39}], [('a/D', 3), {'error': 'start-stop'}], [('A117.T', 2.5), {'error': 'start-stop'}], [('A-$1A', 3), {'modules': 63}], [('aB', 3), {'error': 'start-stop'}]]]
labels = ["regression: minimum symbol length", "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: minimum symbol length 0{'error': 'start-stop'}{'error': 'start-stop'}Passed
repair trap 1{'error': 'short'}{'error': 'short'}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': 'start-stop'}{'error': 'start-stop'}Passed
boundary 5{'error': 'ratio'}{'error': 'ratio'}Passed
boundary 6{'error': 'ratio'}{'error': 'ratio'}Passed
control 7{'modules': 27}{'modules': 27}Passed

SHA-256 / 8dd12bbb47eb069c17484778e648a6bb906e44af1d181b3d6ee734bed663b9e8

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

Case digest / 4c65c2134c8572774018c1020f19f9b01474b05b1f9500cd6dd35d5f955d3a9c