vercel-labs/agent-skills · error · Error

PROJECT_SCOPE_UNRESOLVED

PROJECT_SCOPE_UNRESOLVED

Error message

PROJECT_SCOPE_UNRESOLVED: the project was resolved without an owner account. Ask the user which Vercel team or personal scope owns the project, then rerun from a linked app directory or set VERCEL_PROJECT_ID with VERCEL_ORG_ID for that scope.

What it means

Thrown by main() when resolveProjectId returned a project object but its orgId is null/falsy. The collector needs an owner account to scope every metrics/usage/contract call, so a project resolved without an owner is unusable. This happens when the project id is known but the owning team/user could not be determined from link files or env.

Source

Thrown at skills/vercel-optimize/scripts/collect-signals.mjs:79

  log('checking Vercel CLI version…');
  const cli = await checkCliVersion();
  log(`vercel CLI v${cli.join('.')} OK`);

  log('checking auth…');
  await checkAuth();
  log('auth OK');

  log('resolving project id…');
  const project = await resolveProjectId(explicitProjectId);
  if (!project) {
    throw new Error(
      'NO_PROJECT_ID: pass one as argv, set VERCEL_PROJECT_ID, or run `vercel link` in this directory.'
    );
  }
  log(`project link resolved (source=${project.source}; teamScope=${project.orgId ? 'yes' : 'no'})`);

  if (!project.orgId) {
    throw new Error('PROJECT_SCOPE_UNRESOLVED: the project was resolved without an owner account. Ask the user which Vercel team or personal scope owns the project, then rerun from a linked app directory or set VERCEL_PROJECT_ID with VERCEL_ORG_ID for that scope.');
  }

  log('checking framework support…');
  const stack = await detectStack();
  const frameworkSupport = classifyFrameworkSupport(stack);
  log(`framework=${stack.framework}@${stack.frameworkVersion ?? '?'} support=${frameworkSupport.status}`);

  if (!frameworkSupport.ok && !continueUnsupportedFramework) {
    writeOutput({
      schemaVersion: SCHEMA_VERSION,
      collectedAt: new Date().toISOString(),
      timeWindow: TIME_WINDOW,
      projectId: project.projectId,
      orgId: project.orgId,
      projectIdSource: project.source,
      commandScope: null,
      frameworkSupport,
      frameworkSupportBlocker: frameworkSupport.blocker,

View on GitHub (pinned to b8caa260a4)

Solutions

  1. Set VERCEL_ORG_ID to the owning team (`team_…`) or user (`usr_…`) id for that project.
  2. Re-link from the app directory so project.json/repo.json records both projectId and orgId.
  3. Confirm with the user which Vercel team/personal scope owns the project, then rerun with both ids set.

Example fix

# before
$ VERCEL_PROJECT_ID=prj_xxx node scripts/collect-signals.mjs
-> PROJECT_SCOPE_UNRESOLVED: resolved without an owner account.

# after — supply the owner
$ VERCEL_PROJECT_ID=prj_xxx VERCEL_ORG_ID=team_yyy node scripts/collect-signals.mjs
Defensive patterns

Strategy: validation

Validate before calling

async function assertProjectHasOwner(explicit) {
  const project = await resolveProjectId(explicit);
  if (!project) throw new Error('NO_PROJECT_ID');
  if (!project.orgId) {
    throw new Error('Project resolved without owner; set VERCEL_ORG_ID for the owning team/user');
  }
  return project;
}
const project = await assertProjectHasOwner(explicitProjectId);

Type guard

function hasOwnerScope(project) {
  return !!project && typeof project.projectId === 'string' && !!project.orgId;
}

Prevention

When it happens

Trigger: explicit projectId passed (positional or VERCEL_PROJECT_ID) with no VERCEL_ORG_ID and readLinkedOwnerForProjectId returned null (no matching repo.json/project.json entry with an orgId); legacy project.json present but its orgId field is empty.

Common situations: CI sets VERCEL_PROJECT_ID but forgets VERCEL_ORG_ID; a linked project.json missing the orgId field; running in a dir where the link file has the id but not the owner.

Related errors


AI-assisted analysis of vercel-labs/agent-skills@b8caa260a4 (2026-08-13). Data as JSON: /api/errors/1ce4cba3115bf0d0. Report an issue: GitHub.