vercel/next.js · error

Unknown weight {} for font {}. Available weights: {}

Error message

Unknown weight {} for font {}.
Available weights: {}

What it means

Thrown by options_from_request() when a requested weight is not present in the font's available weights list (from the Google Fonts metadata). Each requested weight is checked against font_data.weights; any miss bails with the available set for guidance.

Source

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

                font_data.weights.join(", ")
            )
        }

        FontWeights::Variable
    } else if requested_weights.contains("variable") {
        if requested_weights.len() > 1 {
            anyhow::bail!(
                "Unexpected `variable` in weight array for font {}. You only need `variable`, it \
                 includes all available weights.",
                font_family
            )
        }

        FontWeights::Variable
    } else {
        for requested_weight in &requested_weights {
            if !font_data.weights.contains(requested_weight) {
                anyhow::bail!(
                    "Unknown weight {} for font {}.\nAvailable weights: {}",
                    requested_weight,
                    font_family,
                    font_data.weights.join(", ")
                )
            }
        }

        let mut weights = vec![];
        for weight in requested_weights {
            weights.push(weight.parse()?);
        }

        FontWeights::Fixed(weights)
    };

    if styles.is_empty() {
        if font_data.styles.len() == 1 {

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Use a weight listed in the error message's 'Available weights'.
  2. Double-check numeric weights are valid CSS font-weights the font actually ships (commonly 100–900 in steps).
  3. If you wanted all weights, use `weight: 'variable'` for a variable font.

Example fix

// before
const font = Merriweather({ subsets: ['latin'], weight: '450' })
// after
const font = Merriweather({ subsets: ['latin'], weight: '400' })
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Passing a weight the font doesn't offer, e.g. `weight: '450'` for a font that only has 400/700, or a typo'd weight string.

Common situations: Guessing a weight value; font family changed its available weights upstream; typo like '40' instead of '400'.

Related errors


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