nexu-io/open-design · error · Error

Vela ${command} returned no JSON output

Error message

Vela ${command} returned no JSON output

What it means

Thrown by parseJsonObject() in vela.ts when the Vela CLI's stdout is empty after trimming. The daemon expects every Vela command run with --json to emit a JSON object on stdout; an empty stdout means the CLI exited without producing the structured payload. The command name is interpolated so the caller knows which Vela subcommand failed.

Source

Thrown at apps/daemon/src/media/vela.ts:78

const VELA_IMAGE_TIMEOUT_MS = 330_000;
const VELA_MODELS_TIMEOUT_MS = 30_000;
const VELA_VIDEO_SUBMIT_TIMEOUT_MS = 330_000;
const DEFAULT_VELA_VIDEO_POLL_COMMAND_TIMEOUT_MS = 90_000;
const DEFAULT_VELA_VIDEO_POLL_INTERVAL_MS = 5_000;
const DEFAULT_VELA_VIDEO_TOTAL_TIMEOUT_MS = 15 * 60_000;
const DEFAULT_VELA_VIDEO_RESOLUTION = '720p';
const VELA_MAX_INPUT_IMAGES = 5;
const VELA_VIDEO_RATIOS = new Set(['16:9', '9:16', '1:1']);
const VELA_VIDEO_DURATIONS = new Set([5, 10]);

function isRecord(value: unknown): value is JsonRecord {
  return value !== null && typeof value === 'object' && !Array.isArray(value);
}

function parseJsonObject(stdout: string, command: string): JsonRecord {
  const trimmed = stdout.trim();
  if (!trimmed) {
    throw new Error(`Vela ${command} returned no JSON output`);
  }
  try {
    const value: unknown = JSON.parse(trimmed);
    if (!isRecord(value)) {
      throw new Error('expected a JSON object');
    }
    return value;
  } catch (error) {
    const detail = error instanceof Error ? error.message : String(error);
    throw new Error(`Vela ${command} returned invalid JSON: ${detail}`);
  }
}

function nonEmptyString(value: unknown): string | null {
  return typeof value === 'string' && value.trim() ? value.trim() : null;
}

function positiveIntegerFromEnv(name: string, fallback: number): number {

View on GitHub (pinned to 5be4028344)

Solutions

  1. Run the same Vela CLI command directly and inspect stderr for the real error
  2. Confirm the installed Vela CLI version supports --json for the failing subcommand
  3. Check Vela login state (vela login / the agent binary resolver) since auth failures can suppress JSON output
  4. Ensure the workspace id (if passed) is valid and accessible
Defensive patterns

Strategy: try-catch

Validate before calling

function isNonEmptyStdout(stdout: string): boolean {
  return stdout.trim().length > 0;
}

const stdout = await runCommand(args, opts);
if (!isNonEmptyStdout(stdout)) {
  throw new Error(`Vela ${label} produced no stdout — check the CLI and stderr`);
}

Try / catch

try {
  const stdout = await runCommand(args, opts);
  const asset = parseJsonObject(stdout, label);
} catch (err) {
  if (err instanceof Error && /returned no JSON output/.test(err.message)) {
    // capture vela stderr / version and surface a richer error
  } else throw err;
}

Prevention

When it happens

Trigger: runCommand (a Vela CLI invocation) returns an empty string for commands like 'image gen', 'image edit', 'media models', or 'video gen'. Happens when the Vela binary writes errors to stderr only, when --json is not honored, or when a CLI crash produces no stdout.

Common situations: Vela CLI version that does not support --json for that subcommand; CLI crashed before emitting output; stderr-only error logging; the binary was killed (OOM / signal) before flushing stdout; misconfigured Vela workspace.

Related errors


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