{"record":{"id":"0b467e204e9b3480","repo":"vercel-labs/agent-skills","slug":"vercel-cli-too-old","errorCode":"VERCEL_CLI_TOO_OLD","errorMessage":"VERCEL_CLI_TOO_OLD: have ${v.join('.')}, need >= ${MIN_CLI_VERSION.join('.')}. Upgrade with `npm i -g vercel@latest`.","messagePattern":"VERCEL_CLI_TOO_OLD: have (.+?), need >= (.+?)\\. Upgrade with `npm i -g vercel@latest`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/vercel-optimize/lib/vercel.mjs","lineNumber":107,"sourceCode":"\nconst MIN_CLI_VERSION = [53, 0, 0];\n\n// Pre-v53 lacks `vercel metrics` and `vercel contract`.\nexport async function checkCliVersion() {\n  let raw;\n  try {\n    const { stdout } = await runVercel(['--version']);\n    raw = stdout.trim();\n  } catch (err) {\n    throw new Error('VERCEL_NOT_INSTALLED: `vercel` CLI not found in PATH. Install with `npm i -g vercel@latest`.');\n  }\n  const m = raw.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n  if (!m) throw new Error(`VERCEL_VERSION_UNPARSEABLE: ${raw}`);\n  const v = [Number(m[1]), Number(m[2]), Number(m[3])];\n  for (let i = 0; i < 3; i++) {\n    if (v[i] > MIN_CLI_VERSION[i]) return v;\n    if (v[i] < MIN_CLI_VERSION[i]) {\n      throw new Error(\n        `VERCEL_CLI_TOO_OLD: have ${v.join('.')}, need >= ${MIN_CLI_VERSION.join('.')}. Upgrade with \\`npm i -g vercel@latest\\`.`\n      );\n    }\n  }\n  return v;\n}\n\nexport async function checkAuth() {\n  try {\n    await runVercel(['whoami']);\n  } catch {\n    throw new Error('NOT_AUTH: run `vercel login`.');\n  }\n}\n\nexport async function getCliIdentity() {\n  const r = await runVercelJson(['whoami', '--format', 'json']);\n  return r.ok ? r.data : null;","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/vercel-labs/agent-skills/blob/b8caa260a420a73042e35521de4b5c8baf6446cc/skills/vercel-optimize/lib/vercel.mjs#L89-L125","documentation":"Thrown by checkCliVersion() after parsing the CLI version and comparing component-by-component against MIN_CLI_VERSION=[53,0,0]. The skill requires v53+ because pre-v53 lacks the `vercel metrics`, `vercel contract`, and `vercel api` subcommands the collector depends on (per the file comment). When any component is below the floor at the first differing index, the run aborts with the have/need versions.","triggerScenarios":"An installed CLI at v52.x or earlier (lacks metrics/contract subcommands); a system with an old pinned `vercel` from a lockfile or system package manager; a Docker image baked with an older CLI.","commonSituations":"Long-lived CI image that ships vercel v42; a team pinning `vercel@^28` in package.json; an OS package (Homebrew/snap) lagging behind npm; local install forgotten after a machine migration.","solutions":["Upgrade: `npm i -g vercel@latest`, then re-run after confirming `vercel --version` reports >= 53.0.0.","If a project pins an old CLI in devDependencies, bump that pin to `vercel@latest` and reinstall.","Rebuild any Docker/CI image that bakes the CLI version in, so stale images stop circulating."],"exampleFix":"// before (package.json or global install pinning an old CLI)\n\"vercel\": \"^28.0.0\"\n\n// after\n\"vercel\": \"^53.0.0\"\n// then: npm i -g vercel@latest  (or npm i for the devDependency)","handlingStrategy":"validation","validationCode":"import { execFileSync } from 'node:child_process';\nconst MIN = [53, 0, 0];\nfunction assertVersionOk() {\n  const v = execFileSync('vercel', ['--version'], { encoding: 'utf-8' })\n    .match(/(\\d+)\\.(\\d+)\\.(\\d+)/).slice(1).map(Number);\n  for (let i = 0; i < 3; i++) {\n    if (v[i] > MIN[i]) return;\n    if (v[i] < MIN[i]) throw new Error(`vercel ${v.join('.')} < ${MIN.join('.')}; upgrade`);\n  }\n}\nassertVersionOk();","typeGuard":null,"tryCatchPattern":"try {\n  await checkCliVersion();\n} catch (err) {\n  if (err.message.startsWith('VERCEL_CLI_TOO_OLD')) {\n    console.error('Upgrade the CLI and rerun: npm i -g vercel@latest');\n  }\n  throw err;\n}","preventionTips":["Pin `vercel@^53` in devDependencies so a too-old version cannot resolve.","Rebuild Docker/CI images periodically so they carry a current CLI.","Assert the CLI version in a precheck step before collect-signals."],"tags":["cli","versioning","compatibility","vercel"],"backgroundTag":null,"analyzedSha":"b8caa260a420a73042e35521de4b5c8baf6446cc","analyzedAt":"2026-08-13T06:03:29.508Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}