nextjs - ✅(Solved) Fix Montserrat Underline from 'next/font/google' fails to load with "Failed to find font override values" despite being available on Google Fonts [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#91692Fetched 2026-04-08 01:02:26
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
1
Timeline (top)
commented ×1cross-referenced ×1issue_type_added ×1labeled ×1

Error Message

2. Why the error is thrown

Log.error(Failed to find font override values for font \${fontFamily}``);

  • adjustFontFallback: false — skips this lookup; no more error; possible small layout shift when the webfont swaps in (same workaround as in your app/ninx/page.tsx). Bottom line: The package does know about Montserrat Underline for fetching the font; the error is only because the fallback adjustment table still uses the old Montserrat Subrayada key, not Montserrat Underline. Bottom line: The package does know about Montserrat Underline for fetching the font; the error is only because the fallback adjustment table still uses the old Montserrat Subrayada key, not Montserrat Underline.

Root Cause

Bottom line: The package does know about Montserrat Underline for fetching the font; the error is only because the fallback adjustment table still uses the old Montserrat Subrayada key, not Montserrat Underline.

Fix Action

Fix / Workaround

  • adjustFontFallback: false — skips this lookup; no more error; possible small layout shift when the webfont swaps in (same workaround as in your app/ninx/page.tsx).
  • Wait for / contribute to Next — ideally they’d add an alias montserratUnderline → same metrics as montserratSubrayada, or regenerate metrics for the new family name.

PR fix notes

PR #91696: fix(next/font): add font metrics alias for renamed Google Fonts

Description (problem / solution / changelog)

What?

Added a FONT_ALIASES map in capsize_metrics() within taskfile.js so that renamed Google Fonts can resolve their font override metrics at build time.

Why?

Google Fonts renamed "Montserrat Subrayada" to "Montserrat Underline". The @capsizecss/metrics package still uses the old key (montserratSubrayada), so the generated capsize-font-metrics.json has no entry for montserratUnderline. This causes:

⨯ Failed to find font override values for font `Montserrat Underline`

How?

Before writing capsize-font-metrics.json, the build step now checks a FONT_ALIASES map. If a new font name key is missing but the old key exists, it copies the metrics under the new key. This is a minimal fix that doesn't require waiting for upstream @capsizecss/metrics to update.

Fixes #91692

Changed files

  • packages/next/taskfile.js (modified, +17/-0)

Code Example

For **"Montserrat Underline"**, `formatName` produces **`montserratUnderline`**.

In **`capsize-font-metrics.json`**, there is **no** `montserratUnderline` key. There **is** a **`montserratSubrayada`** entry whose `familyName` is **"Montserrat Subrayada"** — the older Google Fonts name for the same design:

---

So: **Google renamed / rebranded the family to “Montserrat Underline”,** but Next’s bundled Capsize metrics file still keys it under the **old** name → lookup for `montserratUnderline` is **undefined** → destructuring throws → `get-fallback-font-override-metrics.js` catches and logs:

---

That matches reports like [vercel/next.js#47115](https://github.com/vercel/next.js/issues/47115) / [vercel/next.js#82079](https://github.com/vercel/next.js/issues/82079): the font exists on Google Fonts, but **precalculated override metrics** aren’t there for that identifier.

## 3. What you can do

- **`adjustFontFallback: false`** — skips this lookup; no more error; possible small layout shift when the webfont swaps in (same workaround as in your `app/ninx/page.tsx`).
- **Wait for / contribute to Next** — ideally they’d add an alias `montserratUnderline` → same metrics as `montserratSubrayada`, or regenerate metrics for the new family name.

**Bottom line:** The package **does** know about Montserrat Underline for **fetching** the font; the error is only because the **fallback adjustment table** still uses the old **Montserrat Subrayada** key, not **Montserrat Underline**.

### Current vs. Expected behavior

**Bottom line:** The package **does** know about Montserrat Underline for **fetching** the font; the error is only because the **fallback adjustment table** still uses the old **Montserrat Subrayada** key, not **Montserrat Underline**.

### Provide environment information
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/ninjapayofficial/Ninjapay-Plugin-Backend

To Reproduce

Here’s what’s going on under the hood in your installed Next.js (15.5.9).

1. Google Fonts catalog vs. fallback metrics (two different things)

next/font/google does not only “check Google.” It uses two separate pieces of data:

PieceRoleMontserrat Underline?
font-data.json (under @next/font)Which families exist on Google Fonts, weights, subsets, etc.Yes"Montserrat Underline" is listed (around line 8513 in your tree).
capsize-font-metrics.json (under next/dist/server)Precomputed metrics for size-adjust / fallback (adjustFontFallback)No entry for the key Next uses for this name

So the font is available on Google Fonts as Montserrat Underline; that’s why Montserrat_Underline from next/font/google can still download and work. The message is not “font missing from Google.”

2. Why the error is thrown

Fallback metrics are resolved in next/dist/server/font-utils.js by turning the family name into a camelCase key and looking it up in capsize-font-metrics.json:

function calculateSizeAdjustValues(fontName) {
    const fontKey = formatName(fontName);
    const fontMetrics = capsizeFontsMetrics[fontKey];
    let { category, ascent, descent, lineGap, unitsPerEm, xWidthAvg } = fontMetrics;

For "Montserrat Underline", formatName produces montserratUnderline.

In capsize-font-metrics.json, there is no montserratUnderline key. There is a montserratSubrayada entry whose familyName is "Montserrat Subrayada" — the older Google Fonts name for the same design:

  "montserratSubrayada": {
    "familyName": "Montserrat Subrayada",
    "fullName": "MontserratSubrayada-Regular",
    "postscriptName": "MontserratSubrayada-Regular",

So: Google renamed / rebranded the family to “Montserrat Underline”, but Next’s bundled Capsize metrics file still keys it under the old name → lookup for montserratUnderline is undefined → destructuring throws → get-fallback-font-override-metrics.js catches and logs:

function getFallbackFontOverrideMetrics(fontFamily) {
    try {
        const { ascent, descent, lineGap, fallbackFont, sizeAdjust } = (0, font_utils_1.calculateSizeAdjustValues)(fontFamily);
        // ...
    }
    catch {
        Log.error(`Failed to find font override values for font \`${fontFamily}\``);
    }
}

That matches reports like vercel/next.js#47115 / vercel/next.js#82079: the font exists on Google Fonts, but precalculated override metrics aren’t there for that identifier.

3. What you can do

  • adjustFontFallback: false — skips this lookup; no more error; possible small layout shift when the webfont swaps in (same workaround as in your app/ninx/page.tsx).
  • Wait for / contribute to Next — ideally they’d add an alias montserratUnderline → same metrics as montserratSubrayada, or regenerate metrics for the new family name.

Bottom line: The package does know about Montserrat Underline for fetching the font; the error is only because the fallback adjustment table still uses the old Montserrat Subrayada key, not Montserrat Underline.

Current vs. Expected behavior

Bottom line: The package does know about Montserrat Underline for fetching the font; the error is only because the fallback adjustment table still uses the old Montserrat Subrayada key, not Montserrat Underline.

Provide environment information

Node: 22+

Which area(s) are affected? (Select all that apply)

Not sure, Performance

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed)

Additional context

No response

extent analysis

Fix Plan

To resolve the issue, you can use one of the following approaches:

  • Disable font fallback adjustment: Set adjustFontFallback to false in your Next.js configuration. This will skip the lookup for precalculated override metrics and prevent the error.
// next.config.js
module.exports = {
  // ...
  experimental: {
    fontMetrics: {
      adjustFontFallback: false,
    },
  },
}
  • Use a custom font metrics file: Create a custom capsize-font-metrics.json file with the updated metrics for the "Montserrat Underline" font. You can then configure Next.js to use this custom file.
// next.config.js
module.exports = {
  // ...
  experimental: {
    fontMetrics: {
      customFontMetrics: './path/to/custom-capsize-font-metrics.json',
    },
  },
}
  • Wait for or contribute to the Next.js fix: The Next.js team may address this issue in a future release. You can track the progress of this issue on the Next.js GitHub repository.

Verification

To verify that the fix worked, you can check the following:

  • The error message should no longer appear in the console.
  • The font should render correctly in your application.
  • You can inspect the font metrics in the browser dev tools to ensure that they are being applied correctly.

Extra Tips

  • Make sure to test your application thoroughly after applying the fix to ensure that it works as expected.
  • If you choose to use a custom font metrics file, make sure to keep it up to date with any changes to the font metrics.
  • You can also consider contributing to the Next.js project to help resolve this issue for all users.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING