{"record":{"id":"8eff3267ccd1ad69","repo":"vercel/next.js","slug":"next-font-google-failed-to-run-or-is-incorrectly","errorCode":null,"errorMessage":"@next/font/google failed to run or is incorrectly configured.\n\nRead more: https://nextjs.org/docs/app/building-your-application/optimizing/fonts","messagePattern":"@next/font/google failed to run or is incorrectly configured\\.\n\nRead more: https://nextjs\\.org/docs/app/building-your-application/optimizing/fonts","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/font/google/index.js","lineNumber":15,"sourceCode":"// Validate next version\nconst semver = require('next/dist/compiled/semver')\nif (semver.lt(require('next/package.json').version, '13.0.0')) {\n  throw new Error('`@next/font` is only available in Next.js 13 and newer.')\n}\n\nlet message = '@next/font/google failed to run or is incorrectly configured.'\nif (process.env.NODE_ENV === 'development') {\n  message +=\n    '\\nIf you just installed `@next/font`, please try restarting `next dev` and resaving your file.'\n}\n\nmessage += `\\n\\nRead more: https://nextjs.org/docs/app/building-your-application/optimizing/fonts`\n\nthrow new Error(message)\n","sourceCodeStart":1,"sourceCodeEnd":16,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/font/google/index.js#L1-L16","documentation":"`@next/font/google`'s fallback throw: after the version check passes, the file unconditionally throws this message because the package is a shim — the actual implementation lives inside `next` itself. Seeing this error means the shim's real entry was not patched/replaced by the installed Next.js build, i.e. `@next/font/google` was loaded but Next's loader did not intercept it. It points users to the font docs for correct configuration.","triggerScenarios":"Importing `@next/font/google` in a project where the package was installed standalone from npm (so it runs the shim) rather than being resolved through Next's internal alias; or where the Next build did not rewrite the import to `next/font/google`. The dev hint suggests restarting `next dev` after install.","commonSituations":"Installing `@next/font` from npm in a Next 13+ project where the aliasing should have made it work, but a stale module cache or wrong resolution root causes the shim to execute; bundler resolving the npm package instead of Next's internal copy.","solutions":["Use the built-in `next/font/google` import directly — avoid `@next/font` entirely.","If you just installed/updated, restart `next dev` (the message explicitly suggests this for dev).","Remove `node_modules` and reinstall to clear a stale resolution that loads the shim.","Confirm there is no conflicting local `@next/font` package or alias overriding the Next internal one."],"exampleFix":"// before\nimport { Inter } from '@next/font/google'\n\n// after\nimport { Inter } from 'next/font/google'\nconst inter = Inter({ subsets: ['latin'] })","handlingStrategy":"fallback","validationCode":"// Avoid the shim entirely; import from next/font/google.\n// presence of the shim throwing means resolution mismatch.\ntry {\n  require.resolve('next/font/google')\n} catch {\n  throw new Error('next/font not found; install Next 13.2+')\n}","typeGuard":"function hasBuiltInFont(): boolean {\n  try { require.resolve('next/font/google'); return true } catch { return false }\n}","tryCatchPattern":null,"preventionTips":["Import from next/font/google, not @next/font/google.","Restart next dev after dependency changes.","Clear node_modules if a stale @next/font shim lingers."],"tags":["font","google-fonts","configuration","deprecation","module-resolution"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}