vercel/next.js · error · Error
AI upgrades are not available for prerelease versions of…
Error message
AI upgrades are not available for prerelease versions of Next.js yet.
What it means
AI-assisted upgrades are only implemented for stable releases. If the app's installed Next.js version has a prerelease tag (canary, rc, beta, alpha), prepareUpgrade refuses to run because codemod targets and advisory ranges are not defined against moving prerelease channels yet.
Solutions
- Switch the app to a stable release: npm i next@latest (plus matching react/react-dom), then rerun the upgrade
- Pin a stable version in package.json instead of a canary tag/dist-tag
- If you must stay on canary, upgrade manually with npx @next/codemod@canary upgrade instead of --ai
Example fix
// before "next": "canary" // after "next": "15.3.0"
Defensive patterns
Strategy: validation
Validate before calling
const semver = require('semver')
const v = require('next/package.json').version
if (semver.prerelease(v)) {
console.error('AI upgrade requires a stable next release; current:', v)
} Try / catch
try {
await prepareUpgrade(dir, 'latest')
} catch (e) {
if (e.message.includes('prerelease')) {
// switch to next@latest or use manual @next/codemod upgrade
}
} Prevention
- Pin stable next versions in apps; keep canary in throwaway branches
- Check npm view next dist-tags before choosing a channel
- Use the non-AI `npx @next/codemod@canary upgrade` path for prerelease channels
When it happens
Trigger: Running `next upgrade --ai` in an app whose package.json uses next@canary, next@rc, or a local build with a prerelease version suffix.
Common situations: Apps tracking canary for new features; contributors testing against next rc builds; monorepos where one workspace pins canary.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Could not check Next.js security advisories. Continuing…
- Could not determine the installed Next.js version.
- Could not determine the latest stable Next.js version.
- Could not determine the @next/codemod version.
- Could not prepare adoption documents for
AI-assisted analysis of vercel/next.js@34433fd12e (2026-09-20).
Data as JSON: /api/errors/54382f147ae754f7.
Report an issue: GitHub.
Appendix: source
Thrown at packages/next/src/lib/upgrade/prepare-upgrade.ts:49
)
}
// Resolve from the app: the invoking canary is only the upgrade tooling.
const requireFromApp = createRequire(join(directory, 'package.json'))
const installedNext = JSON.parse(
await readFile(requireFromApp.resolve('next/package.json'), 'utf8')
) as {
version: string
}
const installedVersion = installedNext.version
if (!semver.valid(installedVersion)) {
throw new Error('Could not determine the installed Next.js version.')
}
// TODO: Handle prereleases
if (semver.prerelease(installedVersion)) {
throw new Error(
'AI upgrades are not available for prerelease versions of Next.js yet.'
)
}
if (targetRequest === 'latest' || targetRequest === 'future') {
const url = `${NPM_REGISTRY}next/latest`
const { value } = await fetchJSON(url)
const release = value as { version: string } | null
if (
!release ||
!semver.valid(release.version) ||
semver.prerelease(release.version)
) {
throw new Error('Could not determine the latest stable Next.js version.')
}
const targetVersion =View on GitHub (pinned to 34433fd12e)