{"record":{"id":"87c63f859dbda7db","repo":"vercel-labs/agent-skills","slug":"vercel-version-unparseable","errorCode":"VERCEL_VERSION_UNPARSEABLE","errorMessage":"VERCEL_VERSION_UNPARSEABLE: ${raw}","messagePattern":"VERCEL_VERSION_UNPARSEABLE: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/vercel-optimize/lib/vercel.mjs","lineNumber":102,"sourceCode":"    err.code = 'ENOENT';\n    throw err;\n  }\n  return await exec(command.file, [...command.prefix, ...args], { windowsHide: true, ...opts });\n}\n\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  }","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/vercel-labs/agent-skills/blob/b8caa260a420a73042e35521de4b5c8baf6446cc/skills/vercel-optimize/lib/vercel.mjs#L84-L120","documentation":"Thrown by checkCliVersion() when `vercel --version` succeeded (no rejection) but its stdout did not contain a `major.minor.patch` triple matching /(\\d+)\\.(\\d+)\\.(\\d+)/. The version gate cannot compare against MIN_CLI_VERSION=[53,0,0] without parseable semver, so the skill refuses to proceed rather than guessing. Typical causes are a nonstandard CLI build, a wrapper that prefixes banners, or stderr content captured where stdout was expected.","triggerScenarios":"A forked or aliased `vercel` binary that prints a non-semver banner (e.g. a dev build tagged `vercel-dev-local`); a shell alias that echoes extra lines to stdout before the real version; a future CLI that changes `--version` output format; stdout captured as empty because the real version went to stderr.","commonSituations":"Custom internal CLI wrapper around `vercel`; locale/environment that alters numeric formatting; a proxy/shim that injects a sponsor line into stdout; running an unpublished/canary build whose version string is a git SHA.","solutions":["Run `vercel --version` manually and confirm the output contains a `X.Y.Z` triple on stdout.","Remove any shell alias, function, or wrapper that prepends non-version text to the version command's stdout.","Reinstall the official CLI: `npm i -g vercel@latest`.","If you maintain a wrapper, ensure it forwards stdout verbatim and writes banners to stderr."],"exampleFix":"// before\nconst m = raw.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\nif (!m) throw new Error(`VERCEL_VERSION_UNPARSEABLE: ${raw}`);\n\n// after — tolerate build metadata / prerelease suffixes\nconst m = raw.match(/(\\d+)\\.(\\d+)\\.(\\d+)(?:-[\\w.]+)?/);\nif (!m) throw new Error(`VERCEL_VERSION_UNPARSEABLE: ${JSON.stringify(raw)}`);","handlingStrategy":"validation","validationCode":"import { execFileSync } from 'node:child_process';\nfunction assertVersionParses() {\n  const out = execFileSync('vercel', ['--version'], { encoding: 'utf-8' });\n  if (!/\\d+\\.\\d+\\.\\d+/.test(out)) {\n    throw new Error(`vercel --version output is unparseable: ${JSON.stringify(out)}`);\n  }\n}\nassertVersionParses();","typeGuard":null,"tryCatchPattern":"try {\n  await checkCliVersion();\n} catch (err) {\n  if (err.message.startsWith('VERCEL_VERSION_UNPARSEABLE')) {\n    // inspect raw output, strip wrappers/aliases, then retry once\n    console.error('Could not parse CLI version. Remove any alias/wrapper around `vercel`.');\n  }\n  throw err;\n}","preventionTips":["Do not alias or wrap the `vercel` binary with stdout-injecting banners.","Pin to the official npm `vercel` package rather than a fork.","Smoke-test `vercel --version` in onboarding scripts."],"tags":["cli","versioning","parsing","vercel"],"backgroundTag":null,"analyzedSha":"b8caa260a420a73042e35521de4b5c8baf6446cc","analyzedAt":"2026-08-13T06:03:29.508Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}