subframe7536/maple-font · error · ValueError

Cannot build both `mono` and `propo` glyphs versions simulta

Error message

Cannot build both `mono` and `propo` glyphs versions simultaneously.

What it means

get_font_suffix() maps the build mode to a name suffix: mono -> 'Mono', propo -> 'Propo', neither -> ''. The two glyph variants are mutually exclusive in a single build, so passing mono=True and propo=True together raises this ValueError. Called by build_nf and subset.

Source

Thrown at source/py/task/nerdfont.py:109

    _nf_args = [
        font_forge_bin,
        "FontPatcher/font-patcher",
        "-l",
        "-c",
        "--careful",
    ]
    if mono:
        _nf_args += ["--mono"]
    elif propo:
        _nf_args += ["--variable-width-glyphs"]

    return _nf_args


def get_font_suffix(mono: bool, propo: bool) -> str:
    """Determine the suffix for the font name and file path."""
    if mono and propo:
        raise ValueError(
            "Cannot build both `mono` and `propo` glyphs versions simultaneously."
        )
    if mono:
        return "Mono"
    elif propo:
        return "Propo"
    return ""


def build_nf(mono: bool, propo: bool = False):
    suffix = get_font_suffix(mono, propo)
    nf_args = get_nerd_font_patcher_args(mono, propo)

    nf_file_name = "NerdFont" + suffix
    style_name = "Regular"

    run(nf_args + [base_font_path])
    _path = f"{family_name.replace(' ', '')}{nf_file_name}-{style_name}.ttf"

View on GitHub (pinned to c08fda97fe)

Solutions

  1. Run two separate builds: one with mono=True (propo=False), one with propo=True (mono=False).
  2. Remove one of the conflicting flags from the command/config.
  3. If both variants are needed in a script, call build_nf/subset once per variant instead of once with both.

Example fix

# before
build_nf(mono=True, propo=True)

# after
build_nf(mono=True, propo=False)
build_nf(mono=False, propo=True)
Defensive patterns

Strategy: validation

Validate before calling

assert not (mono and propo), "choose either mono or propo per build; run separate builds for both"

Type guard

def is_valid_nf_mode(mono: bool, propo: bool) -> bool:
    return not (mono and propo)

Try / catch

try:
    build_nf(mono=mono, propo=propo)
except ValueError as e:
    if "mono" in str(e) and "propo" in str(e):
        build_nf(mono=True, propo=False)
        build_nf(mono=False, propo=True)
    else:
        raise

Prevention

When it happens

Trigger: Invoking build_nf/subset (or the CLI) with both --mono and --propo flags set (or mono=true and propo=true in build options).

Common situations: CLI misuse combining flags expecting both outputs; copying a build command and editing it to add propo while leaving mono; scripted builds that default mono=True then append propo=True.

Related errors


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