vercel-labs/agent-skills · critical · Error
NOT_AUTH
NOT_AUTH
Error message
NOT_AUTH: run `vercel login`.
What it means
Thrown by checkAuth() when `runVercel(['whoami'])` rejects. `vercel whoami` exits non-zero when there is no authenticated session, so the rejection indicates the CLI is not logged in. The collector needs an authed session to run every scoped subcommand, so this is a hard gate placed right after the version check.
Source
Thrown at skills/vercel-optimize/lib/vercel.mjs:119
const m = raw.match(/(\d+)\.(\d+)\.(\d+)/);
if (!m) throw new Error(`VERCEL_VERSION_UNPARSEABLE: ${raw}`);
const v = [Number(m[1]), Number(m[2]), Number(m[3])];
for (let i = 0; i < 3; i++) {
if (v[i] > MIN_CLI_VERSION[i]) return v;
if (v[i] < MIN_CLI_VERSION[i]) {
throw new Error(
`VERCEL_CLI_TOO_OLD: have ${v.join('.')}, need >= ${MIN_CLI_VERSION.join('.')}. Upgrade with \`npm i -g vercel@latest\`.`
);
}
}
return v;
}
export async function checkAuth() {
try {
await runVercel(['whoami']);
} catch {
throw new Error('NOT_AUTH: run `vercel login`.');
}
}
export async function getCliIdentity() {
const r = await runVercelJson(['whoami', '--format', 'json']);
return r.ok ? r.data : null;
}
// Supports newer `.vercel/repo.json` (multi-project) + legacy `.vercel/project.json` (single-project).
export async function readProjectJson(cwd = process.cwd()) {
try {
const raw = await readFile(join(cwd, '.vercel', 'repo.json'), 'utf-8');
const parsed = JSON.parse(raw);
const projects = Array.isArray(parsed?.projects) ? parsed.projects.filter((p) => p?.id) : [];
if (projects.length > 1) {
throw new Error('AMBIGUOUS_PROJECT_LINK: `.vercel/repo.json` contains multiple projects. Run from the linked app directory, or pass the intended projectId together with VERCEL_ORG_ID.');
}
const first = projects[0];View on GitHub (pinned to b8caa260a4)
Solutions
- Run `vercel login` interactively and re-run the script.
- For CI/headless, set VERCEL_TOKEN (or run `vercel login --token`) with a valid deployment token, then confirm `vercel whoami` succeeds.
- If the token was revoked, generate a new one in the Vercel dashboard and update the secret.
Example fix
# before $ node scripts/collect-signals.mjs -> NOT_AUTH: run `vercel login`. # after $ vercel login $ vercel whoami # sanity check, should print your username $ node scripts/collect-signals.mjs
Defensive patterns
Strategy: validation
Validate before calling
import { execFileSync } from 'node:child_process';
function assertAuthed() {
try { execFileSync('vercel', ['whoami'], { stdio: 'pipe' }); }
catch { throw new Error('Not logged in. Run `vercel login` or set VERCEL_TOKEN.'); }
}
assertAuthed(); Try / catch
try {
await checkAuth();
} catch (err) {
if (err.message.startsWith('NOT_AUTH')) {
// prompt login flow, then retry
throw new Error('Run `vercel login`, then rerun this script.');
}
throw err;
} Prevention
- In CI, inject a valid VERCEL_TOKEN and assert `vercel whoami` in a precheck.
- Rotate tokens before expiry and update the secret.
- Avoid `vercel logout` in shared environments.
When it happens
Trigger: Running collect-signals on a machine/environment that never ran `vercel login`; a CI runner using token auth where VERCEL_TOKEN is unset or expired; a session that was revoked from the Vercel dashboard; `vercel logout` run earlier in the same shell.
Common situations: Fresh checkout in CI with no token injected; a shared machine where another user logged out; token expired; team SSO re-issued and the local token is stale.
Related errors
AI-assisted analysis of vercel-labs/agent-skills@b8caa260a4 (2026-08-13).
Data as JSON: /api/errors/9a011a881260abb1.
Report an issue: GitHub.