subframe7536/maple-font · error · Exception

All tag content must be in ASCII letters or {list(__map.keys

Error message

All tag content must be in ASCII letters or {list(__map.keys())}, current is {target[1:-1]}

What it means

Inside tag_custom(), after the first and last bracket glyphs, every middle character of the target must be an ASCII letter that can be rendered as a background glyph class (looked up in bg_cls_dict or rendered as '{LETTER}.bg'). Middle characters that are digits, symbols, or non-ASCII letters cannot map to any background class, so an Exception is raised showing the offending middle substring target[1:-1].

Source

Thrown at source/py/feature/calt/tag.py:189

        for g in glyphs:
            if g.isalpha():
                source_list.append(f"@{g.upper()}")
            else:
                source_list.append(ast.gly(g))

        # Parse target
        target_list = []
        for target_gly in target:
            if target_gly in __map:
                target_list.append(f"{__map[target_gly]}.bg")
            elif target_gly.isalpha():
                up = target_gly.upper()
                if up in bg_cls_dict:
                    target_list.append(bg_cls_dict[up])
                else:
                    target_list.append(f"{up}.bg")
            else:
                raise Exception(
                    f"All tag content must be in ASCII letters or {list(__map.keys())}, current is {target[1:-1]}"
                )

        # Generate substitutions in reverse order (from last glyph to first)
        subst_list = []
        for i in range(glyphs_len, 0, -1):
            before = target_list[: i - 1]
            glyph = source_list[i - 1]
            after = source_list[i:] if i < glyphs_len else None
            replace = target_list[i - 1]
            if isinstance(replace, ast.Clazz):
                replace = replace.glyphs[0]
            subst_list.append(ast.subst(before, glyph, after, replace))

        desc = []
        for item in source_list:
            if isinstance(item, str):
                desc.append(item.replace("@", ""))

View on GitHub (pinned to c08fda97fe)

Solutions

  1. Restrict target middle characters to ASCII letters only, e.g. '(TODO)' instead of '(T0D0)'.
  2. Ensure bg_cls_dict contains a Clazz for every uppercase letter used in the target.
  3. Spell numbers/symbols as words (FOUR, DOT) if you need them visually.
  4. Pre-validate with `all(c.isascii() and c.isalpha() for c in target[1:-1])` before calling.

Example fix

// before
tag_custom([('_404_', '(404)')], bg_cls_dict)
// after
tag_custom([('_TODO_', '(TODO)')], bg_cls_dict)
Defensive patterns

Strategy: validation

Validate before calling

def validate_middle_ascii(tgt):
    middle = tgt[1:-1]
    if not all(c.isascii() and c.isalpha() for c in middle):
        raise ValueError(f'target middle {middle!r} must be ASCII letters only')

for _, tgt in content_list:
    validate_middle_ascii(tgt)
tag_custom(content_list, bg_cls_dict)

Type guard

def is_ascii_letter_middle(tgt: str) -> bool:
    return all(c.isascii() and c.isalpha() for c in tgt[1:-1])

Try / catch

try:
    lookup = tag_custom(content_list, bg_cls_dict)
except Exception as e:
    if 'must be in ASCII letters' in str(e):
        content_list = [(s, t) for s, t in content_list if is_ascii_letter_middle(t)]
        lookup = tag_custom(content_list, bg_cls_dict)
    else:
        raise

Prevention

When it happens

Trigger: Calling tag_custom with a target like '(T0D0)' or '(TODO✓)' where characters between the brackets are not A–Z/a–z letters, or where an uppercase letter lacks an entry in bg_cls_dict at a code path that requires it.

Common situations: Designing tags with numbers or symbols in the middle (e.g. '404', 'v1.0'); using accented or non-Latin letters; building bg_cls_dict incompletely so letters are missing from it.

Related errors


AI-assisted analysis of subframe7536/maple-font@c08fda97fe (2026-08-28). Data as JSON: /api/errors/b47093e41393fe8a. Report an issue: GitHub.