vercel/next.js · error

Missing weight for {}. Available weights: {}

Error message

Missing weight for {}. Available weights: {}

What it means

Thrown by options_from_request() when no weight is specified for a Google font that is NOT a variable font (i.e. its available weights list does not contain 'variable'). Non-variable fonts require an explicit weight because there is no default axis range to fall back to.

Source

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

        .weight
        .map(|w| match w {
            OneOrManyStrings::One(one) => fxindexset![one],
            OneOrManyStrings::Many(many) => many.into_iter().collect(),
        })
        .unwrap_or_default();

    let mut styles = argument
        .style
        .map(|w| match w {
            OneOrManyStrings::One(one) => vec![one],
            OneOrManyStrings::Many(many) => many,
        })
        .unwrap_or_default();

    let supports_variable_weight = font_data.weights.iter().any(|el| el == "variable");
    let weights = if requested_weights.is_empty() {
        if !supports_variable_weight {
            anyhow::bail!(
                "Missing weight for {}. Available weights: {}",
                font_family,
                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 {

View on GitHub (pinned to 0ae8c72462)

Solutions

  1. Add an explicit `weight` property matching one of the listed available weights.
  2. Switch to a variable variant of the font (one whose available weights include 'variable') if you want to omit weight.
  3. Re-check the available weights in the error message and pick a valid value.

Example fix

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

Strategy: validation

Prevention

When it happens

Trigger: Calling a non-variable Google font without a `weight` property, e.g. `Roboto({ subsets: ['latin'] })` where Roboto in the fetched font data has no 'variable' entry. The validator checks supports_variable_weight and bails when weights are empty and the font isn't variable.

Common situations: Copying a variable-font example (which omits weight) onto a non-variable font; assuming a default weight exists; the font metadata doesn't list 'variable'.

Related errors


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