FAILURE MAP
← Case archive

FA-99781 / Tool call schema validation / Open access

String length uses UTF-8 bytes instead of characters · case 01

String length uses UTF-8 bytes instead of characters.

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

ROOT CAUSE

The implementation measures encoded bytes instead of string characters.

THE FAILURE

The implementation measures encoded bytes instead of string characters.

Unsuccessful approach: Counting distinct characters fails for repeated letters even in ASCII.

Case contract

Length bounds count Python Unicode code points in the supplied string.

Why this case matters

Tool argument validation prevents malformed structured payloads from entering a deterministic downstream operation.

1 / The failure

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

N = 1
observations = []
def solve(value, minimum):
    return len(value.encode('utf-8')) >= minimum
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ASCII length',solve('abc',N),3>=N)
check('repeated letters',solve('a'*(N+1),N+1),True)
check('unicode one character',solve('é',1),True)
check('unicode byte count is not length',solve('é',2),False)
check('empty minimum zero',solve('',0),True)
check('empty positive minimum',solve('',1),False)
check('supplementary character',solve('🙂',1),True)
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
ASCII lengthTrueTruePassed
repeated lettersTrueTruePassed
unicode one characterTrueTruePassed
unicode byte count is not lengthTrueFalseFailed
empty minimum zeroTrueTruePassed
empty positive minimumFalseFalsePassed
supplementary characterTrueTruePassed

SHA-256 / 74273fdb5eaf2e0afce57e0d00d7d8a20db5db8f75989d1300c02acfb8d9b6b3

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(value, minimum):
    return len(set(value)) >= minimum
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ASCII length',solve('abc',N),3>=N)
check('repeated letters',solve('a'*(N+1),N+1),True)
check('unicode one character',solve('é',1),True)
check('unicode byte count is not length',solve('é',2),False)
check('empty minimum zero',solve('',0),True)
check('empty positive minimum',solve('',1),False)
check('supplementary character',solve('🙂',1),True)
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
ASCII lengthTrueTruePassed
repeated lettersFalseTrueFailed
unicode one characterTrueTruePassed
unicode byte count is not lengthFalseFalsePassed
empty minimum zeroTrueTruePassed
empty positive minimumFalseFalsePassed
supplementary characterTrueTruePassed

SHA-256 / 387f79609ed9bf2ecbf2477e1570ee74fd0871e256b66c8774ceb2f51ed95b51

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Self-contained toy JSON-like schema contract over in-memory Python values; no compatibility with a production schema standard or callable binding is claimed. 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-30T16:48:28.065003+00:00.

Case digest / 3e0e5bc5d3e1e62ff73491c6fc997cbf68288de0fc0875d152b8e50b0b073695