vercel/next.js · error
Only zero or one arguments to font functions are currently s
Error message
Only zero or one arguments to font functions are currently supported
What it means
Thrown by options_from_request() in the Rust next-font (Google) validator when request.arguments has more than one entry. The next/font/google loader semantics allow zero arguments (defaults) or exactly one configuration object; multiple argument objects are unsupported.
Source
Thrown at crates/next-core/src/next_font/google/options.rs:79
#[derive(Debug, PartialEq, Deserialize, TraceRawVcs, NonLocalValue, Encode, Decode)]
#[serde(rename_all = "camelCase")]
pub(super) struct Axis {
pub tag: RcStr,
pub min: f64,
pub max: f64,
}
impl Eq for Axis {}
// Transforms the request fields to a struct suitable for making requests to
// Google Fonts. Similar to next/font/google's validateData:
// https://github.com/vercel/next.js/blob/28454c6ddbc310419467e5415aee26e48d079b46/packages/font/src/google/utils.ts#L22
pub(super) fn options_from_request(
request: &NextFontRequest,
data: &FxIndexMap<RcStr, FontDataEntry>,
) -> Result<NextFontGoogleOptions> {
if request.arguments.len() > 1 {
anyhow::bail!("Only zero or one arguments to font functions are currently supported")
}
// Invariant enforced above: either None or Some(the only item in the vec)
let argument = request.arguments.last().cloned().unwrap_or_default();
// `import` comes from the imported symbol in JS, which separates with _
let font_family: RcStr = request.import.replace('_', " ").into();
let font_data = data.get(&font_family).context("Unknown font")?;
let requested_weights: FxIndexSet<RcStr> = argument
.weight
.map(|w| match w {
OneOrManyStrings::One(one) => fxindexset![one],
OneOrManyStrings::Many(many) => many.into_iter().collect(),
})
.unwrap_or_default();
let mut styles = argument
.styleView on GitHub (pinned to 0ae8c72462)
Solutions
- Call the Google font function with at most one configuration object: `Roboto({ subsets: ['latin'] })`.
- If you need multiple fonts, create separate font function calls rather than passing multiple config objects.
- Regenerate/rebuild to ensure the SWC transform emits a single argument object.
Example fix
// before
const font = Roboto({ subsets: ['latin'] }, { weight: '400' })
// after
const font = Roboto({ subsets: ['latin'], weight: '400' }) Defensive patterns
Strategy: validation
Prevention
- Call each Google font with zero or exactly one config object.
- Use separate font calls for multiple fonts rather than multiple arguments.
- Rely on the standard next/font/google API; avoid manually constructing font requests.
When it happens
Trigger: A next/font/google invocation that the request layer serialized with >1 argument object — typically a malformed macro/generated call to the font function passing multiple config objects.
Common situations: Tooling or a code generator emitting a font call with extra arguments; manually constructing the font request outside the normal loader; an edge case in the SWC transform producing duplicated argument objects.
Related errors
- Missing weight for {}. Available weights: {}
- Unexpected `variable` in weight array for font {}. You only
- Unknown weight {} for font {}. Available weights: {}
- Unknown style {} for font {}. Available styles: {}
- Invalid display value {} for font {}. Available display valu
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/add78ad7752969d0.
Report an issue: GitHub.