FAILURE MAP
← Case archive

FA-84131 / Sports scoring and tiebreakers / Open access

Pitcher with no outs crashes the ERA · case 01

A reliever who faced batters without recording an out raises a division error or shows 0.00.

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

ROOT CAUSE

The zero-outs case is not handled before dividing.

VERIFIED REPAIR

Return "INF" with earned runs, "0.00" without.

Unsuccessful approach: Always returning "0.00" hides earned runs allowed without an out.

Case contract

Pitching line aggregation. outings rows are [innings_pitched, earned_runs] where innings pitched use baseball notation "6.2" = 6 innings and 2 outs (the digit after the point is 0-2; otherwise return "invalid ip <text>"). Sum outs exactly. ERA = innings_per_game * earned runs / innings, rounded half up to two decimals. Return [total innings "I.O", ERA string]; with zero outs ERA is "INF" if any earned runs else "0.00".

Why this case matters

Box scores and stat pages aggregate outs across appearances; thirds of an inning are notorious.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    v = Fraction(innings_per_game * er * 3, outs)
    cents = math.floor(v * 100 + Fraction(1, 2))
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 0]], 9), ['0.0', '0.00']),
  ('regression: zero out guard', ([['0.0', 4]], 9), ['0.0', 'INF']),
  ('variant scenario 1', ([['1.0', 4]], 9), ['1.0', '36.00']),
  ('variant scenario 2', ([['8.0', 2]], 7), ['8.0', '1.75'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 3]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['7.2', 3], ['8.0', 0]], 9), ['15.2', '1.72']),
  ('variant scenario 2', ([['7.1', 2]], 9), ['7.1', '2.45'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['9', 1], ['1.0', 1], ['8.2', 4], ['8.3', 2], ['4.3', 1]], 9),
   'invalid ip 8.3'),
  ('variant scenario 2', ([['7.3', 3], ['1.0', 3], ['8.2', 0], ['7.2', 2]], 9), 'invalid ip 7.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['8.1', 3], ['0.1', 4], ['6.1', 4], ['7.0', 4], ['1', 2]], 9),
   ['23.0', '6.65']),
  ('variant scenario 2', ([['1', 1], ['1.1', 4], ['0.2', 0]], 7), ['3.0', '11.67'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['3.1', 2], ['4.1', 4]], 9), ['7.2', '7.04']),
  ('variant scenario 2',
   ([['0.1', 0], ['5.2', 2], ['5.1', 1], ['4.1', 4], ['6.3', 1], ['7.1', 0], ['0.1', 1]], 9),
   'invalid ip 6.3')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
control complete game['9.0', '2.00']['9.0', '2.00']Passed
boundary thirds carry['7.0', '1.29']['7.0', '1.29']Passed
boundary seven-inning game['7.0', '3.00']['7.0', '3.00']Passed
boundary no outs with runsraised ZeroDivisionError['0.0', 'INF']Failed
boundary invalid out digitinvalid ip 4.3invalid ip 4.3Passed
control half-up rounding['8.0', '3.38']['8.0', '3.38']Passed
regression: zero out guardraised ZeroDivisionError['0.0', '0.00']Failed
regression: zero out guardraised ZeroDivisionError['0.0', 'INF']Failed
variant scenario 1['1.0', '36.00']['1.0', '36.00']Passed
variant scenario 2['8.0', '1.75']['8.0', '1.75']Passed

SHA-256 / 1b167665174453fbe86e5fdf95f6df0a61a8f3161bbe7e0ec2bd9dedfc3f386b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, '0.00']
    v = Fraction(innings_per_game * er * 3, outs)
    cents = math.floor(v * 100 + Fraction(1, 2))
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 0]], 9), ['0.0', '0.00']),
  ('regression: zero out guard', ([['0.0', 4]], 9), ['0.0', 'INF']),
  ('variant scenario 1', ([['1.0', 4]], 9), ['1.0', '36.00']),
  ('variant scenario 2', ([['8.0', 2]], 7), ['8.0', '1.75'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 3]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['7.2', 3], ['8.0', 0]], 9), ['15.2', '1.72']),
  ('variant scenario 2', ([['7.1', 2]], 9), ['7.1', '2.45'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['9', 1], ['1.0', 1], ['8.2', 4], ['8.3', 2], ['4.3', 1]], 9),
   'invalid ip 8.3'),
  ('variant scenario 2', ([['7.3', 3], ['1.0', 3], ['8.2', 0], ['7.2', 2]], 9), 'invalid ip 7.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['8.1', 3], ['0.1', 4], ['6.1', 4], ['7.0', 4], ['1', 2]], 9),
   ['23.0', '6.65']),
  ('variant scenario 2', ([['1', 1], ['1.1', 4], ['0.2', 0]], 7), ['3.0', '11.67'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['3.1', 2], ['4.1', 4]], 9), ['7.2', '7.04']),
  ('variant scenario 2',
   ([['0.1', 0], ['5.2', 2], ['5.1', 1], ['4.1', 4], ['6.3', 1], ['7.1', 0], ['0.1', 1]], 9),
   'invalid ip 6.3')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
control complete game['9.0', '2.00']['9.0', '2.00']Passed
boundary thirds carry['7.0', '1.29']['7.0', '1.29']Passed
boundary seven-inning game['7.0', '3.00']['7.0', '3.00']Passed
boundary no outs with runs['0.0', '0.00']['0.0', 'INF']Failed
boundary invalid out digitinvalid ip 4.3invalid ip 4.3Passed
control half-up rounding['8.0', '3.38']['8.0', '3.38']Passed
regression: zero out guard['0.0', '0.00']['0.0', '0.00']Passed
regression: zero out guard['0.0', '0.00']['0.0', 'INF']Failed
variant scenario 1['1.0', '36.00']['1.0', '36.00']Passed
variant scenario 2['8.0', '1.75']['8.0', '1.75']Passed

SHA-256 / 418d94eed6c9c10466730dcb398c6eb8d8767066c4c8e4fac766a67e17b06a07

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, 'INF' if er else '0.00']
    v = Fraction(innings_per_game * er * 3, outs)
    cents = math.floor(v * 100 + Fraction(1, 2))
    return [ip_str, '%d.%02d' % (cents // 100, cents % 100)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 0]], 9), ['0.0', '0.00']),
  ('regression: zero out guard', ([['0.0', 4]], 9), ['0.0', 'INF']),
  ('variant scenario 1', ([['1.0', 4]], 9), ['1.0', '36.00']),
  ('variant scenario 2', ([['8.0', 2]], 7), ['8.0', '1.75'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 3]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['7.2', 3], ['8.0', 0]], 9), ['15.2', '1.72']),
  ('variant scenario 2', ([['7.1', 2]], 9), ['7.1', '2.45'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['9', 1], ['1.0', 1], ['8.2', 4], ['8.3', 2], ['4.3', 1]], 9),
   'invalid ip 8.3'),
  ('variant scenario 2', ([['7.3', 3], ['1.0', 3], ['8.2', 0], ['7.2', 2]], 9), 'invalid ip 7.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1',
   ([['8.1', 3], ['0.1', 4], ['6.1', 4], ['7.0', 4], ['1', 2]], 9),
   ['23.0', '6.65']),
  ('variant scenario 2', ([['1', 1], ['1.1', 4], ['0.2', 0]], 7), ['3.0', '11.67'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: zero out guard', ([['0.0', 1]], 7), ['0.0', 'INF']),
  ('variant scenario 1', ([['3.1', 2], ['4.1', 4]], 9), ['7.2', '7.04']),
  ('variant scenario 2',
   ([['0.1', 0], ['5.2', 2], ['5.1', 1], ['4.1', 4], ['6.3', 1], ['7.1', 0], ['0.1', 1]], 9),
   'invalid ip 6.3')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
control complete game['9.0', '2.00']['9.0', '2.00']Passed
boundary thirds carry['7.0', '1.29']['7.0', '1.29']Passed
boundary seven-inning game['7.0', '3.00']['7.0', '3.00']Passed
boundary no outs with runs['0.0', 'INF']['0.0', 'INF']Passed
boundary invalid out digitinvalid ip 4.3invalid ip 4.3Passed
control half-up rounding['8.0', '3.38']['8.0', '3.38']Passed
regression: zero out guard['0.0', '0.00']['0.0', '0.00']Passed
regression: zero out guard['0.0', 'INF']['0.0', 'INF']Passed
variant scenario 1['1.0', '36.00']['1.0', '36.00']Passed
variant scenario 2['8.0', '1.75']['8.0', '1.75']Passed

SHA-256 / 48bc2a8b8f94eb9d825d5c54e10b2d110608126b6653ecc1638cbb3729e3c9a5

Verification & scope

Stipulated, bounded toy contract stated in the contract field; not a claim of conformance with any governing body rulebook or operator house rules. 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:50:27.877869+00:00.

Case digest / 3ce20a5f5c9965c95eb8cf25c56422f54122e5f1f59df3f538227f9f90c0830d