{"record":{"id":"437bc29216897eba","repo":"vercel/next.js","slug":"next-font-local-failed-to-run-or-is-incorrectly-c","errorCode":null,"errorMessage":"@next/font/local failed to run or is incorrectly configured.\n\nRead more: https://nextjs.org/docs/app/building-your-application/optimizing/fonts","messagePattern":"@next/font/local 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/local/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/local 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/local/index.js#L1-L16","documentation":"`@next/font/local`'s shim throw: after the version check passes, the file unconditionally throws because the real implementation lives inside `next`. Hitting this means the standalone `@next/font/local` package executed instead of being aliased to Next's internal implementation. As with the google variant, the message directs users to the font docs and (in dev) suggests restarting `next dev` after install.","triggerScenarios":"Importing `@next/font/local` where the npm-published shim runs (rather than Next's internal `next/font/local`), e.g. wrong resolution, stale cache, or a bundler not applying Next's alias.","commonSituations":"Standalone `@next/font` install that the build failed to alias; stale node_modules after a Next upgrade; conflicting local package shadowing Next's internal one.","solutions":["Import from the built-in `next/font/local` instead of `@next/font/local`.","Restart `next dev` after installing/updating (the dev hint calls this out).","Clear `node_modules` and lockfile and reinstall to fix resolution.","Ensure no local folder/alias named `@next/font` shadows the package."],"exampleFix":"// before\nimport localFont from '@next/font/local'\n\n// after\nimport localFont from 'next/font/local'\nconst myFont = localFont({ src: './my-font.woff2' })","handlingStrategy":"fallback","validationCode":"// Prefer the built-in; detect it before relying on @next/font/local.\ntry {\n  require.resolve('next/font/local')\n} catch {\n  throw new Error('next/font/local not found; install Next 13.2+')\n}","typeGuard":"function hasBuiltInLocalFont(): boolean {\n  try { require.resolve('next/font/local'); return true } catch { return false }\n}","tryCatchPattern":null,"preventionTips":["Import from next/font/local, not @next/font/local.","Restart next dev after installing/updating.","Reinstall node_modules to clear stale shims."],"tags":["font","local-font","configuration","deprecation","module-resolution"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}