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
- Add an explicit `weight` property matching one of the listed available weights.
- Switch to a variable variant of the font (one whose available weights include 'variable') if you want to omit weight.
- 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
- For non-variable fonts, always specify a valid weight.
- Use 'variable' weight only for fonts that offer a variable variant.
- Copy the available-weights list from the font's Google Fonts page.
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
- Unexpected `variable` in weight array for font {}. You only
- Unknown weight {} for font {}. Available weights: {}
- Axes can only be defined for variable fonts when the weight
- Only zero or one arguments to font functions are currently s
- Unknown style {} for font {}. Available styles: {}
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/4e89a338f814d582.
Report an issue: GitHub.