{"record":{"id":"6e6be992cef636af","repo":"vercel/next.js","slug":"axes-can-only-be-defined-for-variable-fonts","errorCode":null,"errorMessage":"Axes can only be defined for variable fonts.","messagePattern":"Axes can only be defined for variable fonts\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/next-core/src/next_font/google/options.rs","lineNumber":179,"sourceCode":"        }\n    }\n\n    let display = argument.display.unwrap_or_else(|| rcstr!(\"swap\"));\n\n    if !ALLOWED_DISPLAY_VALUES.contains(&display.as_str()) {\n        anyhow::bail!(\n            \"Invalid display value {} for font {}.\\nAvailable display values: {}\",\n            display,\n            font_family,\n            ALLOWED_DISPLAY_VALUES.join(\", \")\n        )\n    }\n\n    if let Some(axes) = argument.axes.as_ref()\n        && !axes.is_empty()\n    {\n        if !supports_variable_weight {\n            anyhow::bail!(\"Axes can only be defined for variable fonts.\")\n        }\n\n        if weights != FontWeights::Variable {\n            anyhow::bail!(\n                \"Axes can only be defined for variable fonts when the weight property is \\\n                 nonexistent or set to `variable`.\"\n            )\n        }\n    }\n\n    Ok(NextFontGoogleOptions {\n        font_family,\n        weights,\n        styles,\n        display,\n        preload: argument.preload.unwrap_or(true),\n        selected_variable_axes: argument.axes,\n        fallback: argument.fallback,","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/crates/next-core/src/next_font/google/options.rs#L161-L197","documentation":"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.","triggerScenarios":"Passing `axes: [...]` to a non-variable Google font (one whose available weights don't include 'variable').","commonSituations":"Assuming a font is variable when it isn't; copy-pasting an axes config from a variable font example onto a static font.","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."],"exampleFix":"// before\nconst font = Archivo_Black({ subsets: ['latin'], axes: [{ tag: 'slnt', min: -10, max: 0 }] })\n// after\nconst font = Archivo_Black({ subsets: ['latin'] }) // not a variable font","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["next-font","google-font","font","axes","variable","rust"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}