vercel/next.js · error
Axes can only be defined for variable fonts.
Error message
Axes can only be defined for variable fonts.
What it means
Thrown by options_from_request() when an `axes` array is provided for a font that is NOT a variable font. Custom axes (opsz, slnt, etc.) only exist on variable fonts; the validator checks supports_variable_weight (any weight === 'variable') before allowing axes.
Source
Thrown at crates/next-core/src/next_font/google/options.rs:179
}
}
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`."
)
}
}
Ok(NextFontGoogleOptions {
font_family,
weights,
styles,
display,
preload: argument.preload.unwrap_or(true),
selected_variable_axes: argument.axes,
fallback: argument.fallback,View on GitHub (pinned to 0ae8c72462)
Solutions
- Remove the `axes` property for non-variable fonts.
- Switch to a variable variant of the font (one offering 'variable' weight) to use custom axes.
- Verify the font supports the axes you want via the Google Fonts variable axes listing.
Example fix
// before
const font = Archivo_Black({ subsets: ['latin'], axes: [{ tag: 'slnt', min: -10, max: 0 }] })
// after
const font = Archivo_Black({ subsets: ['latin'] }) // not a variable font Defensive patterns
Strategy: validation
Prevention
- Only define axes for variable fonts (those offering 'variable' weight).
- Confirm the font is variable via the Google Fonts variable listing before adding axes.
- Remove axes config when switching to a static font.
When it happens
Trigger: Passing `axes: [...]` to a non-variable Google font (one whose available weights don't include 'variable').
Common situations: Assuming a font is variable when it isn't; copy-pasting an axes config from a variable font example onto a static font.
Related errors
- Axes can only be defined for variable fonts when the weight
- Unexpected `variable` in weight array for font {}. You only
- Only zero or one arguments to font functions are currently s
- Missing weight for {}. Available weights: {}
- Unknown weight {} for font {}. Available weights: {}
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/6e6be992cef636af.
Report an issue: GitHub.