nexu-io/open-design · error · Error
authorized pull response is not valid JSON
Error message
authorized pull response is not valid JSON
What it means
Thrown by parseReceipt when JSON.parse fails on the trimmed stdout from the Vela `team-projects pull` command. The authorizer is expected to print a JSON receipt; anything that is not valid JSON (an error message, a banner, a partial line, or an empty string) trips this before any field validation runs.
Source
Thrown at apps/daemon/src/collab/authorized-team-project-pull.ts:107
}
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');
}
return {
schemaVersion: parsed.schemaVersion as 1,
workspaceId: requiredString(parsed, 'workspaceId'),
resourceTeamId: requiredString(parsed, 'resourceTeamId'),
viewerMemberId: requiredString(parsed, 'viewerMemberId'),
ownerMemberId: requiredString(parsed, 'ownerMemberId'),
projectId: requiredString(parsed, 'projectId'),
resourceId: requiredString(parsed, 'resourceId'),
ref: parsed.ref as 'published',
version: Number(version),View on GitHub (pinned to 5be4028344)
Solutions
- Run the same Vela command manually and read what it actually prints to stdout.
- Confirm the Vela CLI is logged in and supports `team-projects pull --json`.
- Upgrade the Vela CLI to a version compatible with this daemon build.
- Use isAuthorizedTeamProjectPullUnavailable(error) to detect the 'unknown command' case and fail open if appropriate.
Defensive patterns
Strategy: try-catch
Validate before calling
function looksLikeJsonReceipt(stdout: string): boolean {
const trimmed = stdout.trim();
if (!trimmed) return false;
try { JSON.parse(trimmed); return true; } catch { return false; }
} Try / catch
try {
parseReceipt(stdout);
} catch (err) {
if (isAuthorizedTeamProjectPullUnavailable(err)) {
// CLI lacks the subcommand — fail open per the documented policy
} else if (err instanceof Error && /not valid JSON/.test(err.message)) {
// log stdout, surface a 'vela output malformed' error, abort the pull
}
throw err;
} Prevention
- Confirm the Vela CLI is logged in and supports `team-projects pull --json` before relying on it.
- Capture and log raw Vela stdout/stderr so non-JSON output is diagnosable.
- Use isAuthorizedTeamProjectPullUnavailable to distinguish 'unsupported CLI' from 'malformed output'.
When it happens
Trigger: Vela CLI printed a human-readable error to stdout instead of JSON (auth failure, network error, unknown subcommand), the process was killed mid-output, or stdout mixing warnings with the JSON body.
Common situations: Vela CLI version that lacks the `team-projects pull --json` subcommand (it prints 'unknown command'), an expired/missing login so Vela emits an auth error, or a proxy/wrapper that prefixes stdout with a log line.
Related errors
- authorized pull response must be an object
- authorized pull receipt has invalid ${key}
- AUTHORIZED_TEAM_PROJECT_PULL_RECEIPT_EXPIRED
- authoritative Team resource listing is unavailable
- WORKSPACE_RESOURCE_AUTHORITY_UNAVAILABLE
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/a917afadd3068bc0.
Report an issue: GitHub.