vercel/next.js · error

Invalid display value {} for font {}. Available display valu

Error message

Invalid display value {} for font {}.
Available display values: {}

What it means

Thrown by options_from_request() when the `display` property (CSS font-display descriptor) is not one of the allowed values: auto, block, swap, fallback, optional. These correspond to the CSS font-display spec values; anything else is rejected.

Source

Thrown at crates/next-core/src/next_font/google/options.rs:167

            styles.push(rcstr!("normal"));
        }
    }

    for requested_style in &styles {
        if !font_data.styles.contains(requested_style) {
            anyhow::bail!(
                "Unknown style {} for font {}.\nAvailable styles: {}",
                requested_style,
                font_family,
                font_data.styles.join(", ")
            )
        }
    }

    let display = argument.display.unwrap_or_else(|| rcstr!("swap"));

    if !ALLOWED_DISPLAY_VALUES.contains(&display.as_str()) {
        anyhow::bail!(
            "Invalid display value {} for font {}.\nAvailable display values: {}",
            display,
            font_family,
            ALLOWED_DISPLAY_VALUES.join(", ")
        )
    }

    if let Some(axes) = argument.axes.as_ref()
        && !axes.is_empty()
    {
        if !supports_variable_weight {
            anyhow::bail!("Axes can only be defined for variable fonts.")
        }

        if weights != FontWeights::Variable {
            anyhow::bail!(
                "Axes can only be defined for variable fonts when the weight property is \
                 nonexistent or set to `variable`."

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Use one of: 'auto', 'block', 'swap', 'fallback', 'optional'.
  2. Omit `display` to accept the default 'swap'.

Example fix

// before
const font = Inter({ subsets: ['latin'], display: 'visible' })
// after
const font = Inter({ subsets: ['latin'], display: 'swap' })
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Passing `display: 'none'`, `display: 'hidden'`, or any string outside the allowed set to a Google font. Defaults to 'swap' when omitted, so this only fires on an invalid explicit value.

Common situations: Confusing font-display with CSS `display`; typo like 'swp'; passing a non-spec value.

Related errors


AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06). Data as JSON: /api/errors/b9e00deee077d295. Report an issue: GitHub.