nexu-io/open-design · error · Error

authorized pull receipt has invalid ${key}

Error message

authorized pull receipt has invalid ${key}

What it means

Thrown by requiredString while parseReceipt validates the JSON returned by the Vela `team-projects pull` authorizer. Each receipt field (workspaceId, resourceTeamId, viewerMemberId, ownerMemberId, projectId, resourceId, versionId, manifestDigest, authorizedAt, expiresAt) must be a non-empty string; the `${key}` names which field failed. This is a contract check between Open Design and the Vela CLI/server that produced the receipt.

Source

Thrown at apps/daemon/src/collab/authorized-team-project-pull.ts:97

interface ReceiptValidationInput {
  projectId: string;
  scope: TeamMirrorPullScope;
  expectedVersion: number;
  nowMs?: number;
}

function isRecord(value: unknown): value is Record<string, unknown> {
  return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
}

function requiredString(
  record: Record<string, unknown>,
  key: string,
): string {
  const value = record[key];
  if (typeof value !== 'string' || !value.trim()) {
    throw new Error(`authorized pull receipt has invalid ${key}`);
  }
  return value;
}

function parseReceipt(stdout: string): AuthorizedTeamProjectPullReceipt {
  let parsed: unknown;
  try {
    parsed = JSON.parse(stdout.trim());
  } catch {
    throw new Error('authorized pull response is not valid JSON');
  }
  if (!isRecord(parsed)) {
    throw new Error('authorized pull response must be an object');
  }
  const version = parsed.version;
  if (!Number.isSafeInteger(version) || Number(version) < 0) {
    throw new Error('authorized pull receipt has invalid version');
  }

View on GitHub (pinned to 5be4028344)

Solutions

  1. Check the error message for which `${key}` is invalid and inspect the raw Vela stdout.
  2. Ensure the Vela CLI / server version matches what this daemon build expects (upgrade or pin accordingly).
  3. Re-run the authorized pull; transient partial output can produce this.
  4. If you control the server, confirm the receipt emits all required string fields non-empty.
Defensive patterns

Strategy: validation

Validate before calling

function hasAllReceiptStrings(parsed: unknown, keys: string[]): boolean {
  if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return false;
  const rec = parsed as Record<string, unknown>;
  return keys.every((k) => typeof rec[k] === 'string' && (rec[k] as string).trim().length > 0);
}
const REQUIRED = ['workspaceId','resourceTeamId','viewerMemberId','ownerMemberId','projectId','resourceId','versionId','manifestDigest','authorizedAt','expiresAt'];

Try / catch

try {
  parseReceipt(stdout);
} catch (err) {
  if (err instanceof Error && /receipt has invalid/.test(err.message)) {
    // log raw stdout, signal a version-skew issue, do not proceed with the pull
  }
  throw err;
}

Prevention

When it happens

Trigger: The Vela CLI returned valid JSON but one receipt field was missing, null, an empty string, or a non-string type (e.g. a number where a string id was expected).

Common situations: Version skew between the daemon's expected receipt schema and the Vela CLI/server version that produced it, a partial/truncated stdout capture, or a server-side change that renamed a field.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/83f5c5fb3333c703. Report an issue: GitHub.