{"record":{"id":"add78ad7752969d0","repo":"vercel/next.js","slug":"only-zero-or-one-arguments-to-font-functions-are-c","errorCode":null,"errorMessage":"Only zero or one arguments to font functions are currently supported","messagePattern":"Only zero or one arguments to font functions are currently supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/next-core/src/next_font/google/options.rs","lineNumber":79,"sourceCode":"#[derive(Debug, PartialEq, Deserialize, TraceRawVcs, NonLocalValue, Encode, Decode)]\n#[serde(rename_all = \"camelCase\")]\npub(super) struct Axis {\n    pub tag: RcStr,\n    pub min: f64,\n    pub max: f64,\n}\n\nimpl Eq for Axis {}\n\n// Transforms the request fields to a struct suitable for making requests to\n// Google Fonts. Similar to next/font/google's validateData:\n// https://github.com/vercel/next.js/blob/28454c6ddbc310419467e5415aee26e48d079b46/packages/font/src/google/utils.ts#L22\npub(super) fn options_from_request(\n    request: &NextFontRequest,\n    data: &FxIndexMap<RcStr, FontDataEntry>,\n) -> Result<NextFontGoogleOptions> {\n    if request.arguments.len() > 1 {\n        anyhow::bail!(\"Only zero or one arguments to font functions are currently supported\")\n    }\n    // Invariant enforced above: either None or Some(the only item in the vec)\n    let argument = request.arguments.last().cloned().unwrap_or_default();\n\n    // `import` comes from the imported symbol in JS, which separates with _\n    let font_family: RcStr = request.import.replace('_', \" \").into();\n    let font_data = data.get(&font_family).context(\"Unknown font\")?;\n\n    let requested_weights: FxIndexSet<RcStr> = argument\n        .weight\n        .map(|w| match w {\n            OneOrManyStrings::One(one) => fxindexset![one],\n            OneOrManyStrings::Many(many) => many.into_iter().collect(),\n        })\n        .unwrap_or_default();\n\n    let mut styles = argument\n        .style","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/crates/next-core/src/next_font/google/options.rs#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst font = Roboto({ subsets: ['latin'] }, { weight: '400' })\n// after\nconst font = Roboto({ subsets: ['latin'], weight: '400' })","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["next-font","google-font","font","rust","config"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}