{"record":{"id":"253d544c80a8ece1","repo":"vercel/next.js","slug":"warning","errorCode":null,"errorMessage":"${warning}","messagePattern":"\\$\\{warning\\}","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/next/src/lib/upgrade/nudge.ts","lineNumber":121,"sourceCode":"async function showNudge(\n  options: SecurityNudgeOptions,\n  version: string,\n  kind: NudgeKind,\n  prompt: string,\n  warning: string,\n  errorName: string\n): Promise<void> {\n  let retryAllowed = false\n  try {\n    retryAllowed = await allowNudgeRetry(options, version, kind)\n  } catch {\n    Log.warn(\n      'Could not prepare an upgrade retry. This command will remain blocked.'\n    )\n  }\n\n  if (retryAllowed) {\n    Log.warn(warning)\n    return\n  }\n\n  const error = new Error(prompt)\n  error.name = errorName\n  Object.assign(error, { exitCode: 1 })\n  throw error\n}\n\nasync function getLatestUpgrade(\n  installedVersion: string = process.env.__NEXT_VERSION || 'unknown'\n): Promise<{ installedVersion: string; latestVersion: string } | null> {\n  try {\n    if (!(await getAgentName())) {\n      return null\n    }\n\n    const { getLatestUpgradeVersion } =","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/vercel/next.js/blob/34433fd12ee8074ea3f47af9f36255c7390d0301/packages/next/src/lib/upgrade/nudge.ts#L103-L139","documentation":"This message is the placeholder of the upgrade nudge warning: showNudge logs the caller-supplied `warning` text (a version/security advisory or future-flag notice) when a nudge retry is allowed. It is informational output, not a thrown error; if the user declines the prompt that follows, an Error built from `prompt` with the given errorName and exitCode 1 is raised to exit the command.","triggerScenarios":"Running any CLI command that calls nudgeForSecurity/nudgeForLatest/nudgeForFuture when the installed Next.js version is behind (latest nudge), affected by advisories (security nudge), or eligible for a future flag (future nudge), and a retry is permitted.","commonSituations":"Working on an outdated Next.js minor/major behind the latest release; a security advisory matching the installed version; CI environments where the nudge prompt would block.","solutions":["Run `next upgrade` (or `next upgrade --latest`) to move to the recommended/target version.","For security nudges, upgrade to the patched version named in the advisory.","Suppress the prompt by upgrading, or handle the named error/exit code 1 in automated scripts if the nudge is declined."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check your installed version against latest before running commands\nconst local = require('next/package.json').version\nconst res = await fetch('https://registry.npmjs.org/next/latest')\nconst latest = (await res.json()).version\nconsole.log('behind latest:', local !== latest)","typeGuard":null,"tryCatchPattern":"try {\n  await build()\n} catch (e) {\n  if (e.exitCode === 1 && /upgrade/i.test(e.message || '')) {\n    // user declined / nudge blocked the command; upgrade then retry\n  } else throw e\n}","preventionTips":["Keep Next.js on a recent release so nudges don't trigger.","Automate dependency updates (renovate/dependabot) to avoid version drift.","For security nudges, upgrade promptly to the patched version.","In scripts, handle the named error/exitCode 1 rather than assuming success."],"tags":["upgrade","cli","deprecation","nextjs"],"backgroundTag":"deprecated-api-usage","analyzedSha":"34433fd12ee8074ea3f47af9f36255c7390d0301","analyzedAt":"2026-09-20T18:20:20.576Z","contentChangedAt":"2026-09-20T18:20:20.576Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}