nexu-io/open-design · error · Error

volcengine image response had no data[0]

Error message

volcengine image response had no data[0]

What it means

Thrown when the parsed Seedream response has no `data[0]` entry. The OpenAI-compatible shape requires a `data` array; an empty array or missing `data` field means Volcengine accepted the call but produced no image.

Source

Thrown at apps/daemon/src/media/index.ts:1576

    method: 'POST',
    headers: {
      'authorization': `Bearer ${credentials.apiKey}`,
      'content-type': 'application/json',
    },
    body: JSON.stringify(body),
  }));
  const text = await resp.text();
  if (!resp.ok) {
    throw new Error(`volcengine image ${resp.status}: ${truncate(text, 240)}`);
  }
  let data: any;
  try {
    data = JSON.parse(text);
  } catch {
    throw new Error(`volcengine image non-JSON: ${truncate(text, 200)}`);
  }
  const entry = data && Array.isArray(data.data) ? data.data[0] : null;
  if (!entry) throw new Error('volcengine image response had no data[0]');
  let bytes;
  if (entry.b64_json) {
    bytes = Buffer.from(entry.b64_json, 'base64');
  } else if (entry.url) {
    const imgResp = await fetch(entry.url, withMediaRequestInit(ctx));
    if (!imgResp.ok) throw new Error(`volcengine image fetch ${imgResp.status}`);
    bytes = Buffer.from(await imgResp.arrayBuffer());
  } else {
    throw new Error('volcengine image response missing b64_json/url');
  }
  return {
    bytes,
    providerNote: `volcengine/${ctx.wireModel} · ${ctx.aspect} · ${bytes.length} bytes`,
    suggestedExt: '.png',
  };
}

// ---------------------------------------------------------------------------

View on GitHub (pinned to 5be4028344)

Solutions

  1. Retry once with a reworded prompt to rule out moderation.
  2. Inspect the full parsed body for an embedded `error`/`message` explaining the empty `data`.
  3. Confirm the API path is `/api/v3/images/generations` and the model is activated.
Defensive patterns

Strategy: type-guard

Type guard

function hasVolcengineImageEntry(d: unknown): d is { data: Array<{ b64_json?: string; url?: string }> } {
  return Array.isArray((d as any)?.data) && (d as any).data.length > 0;
}
if (!hasVolcengineImageEntry(data)) {
  throw new Error(`volcengine image response had no data[0]: ${JSON.stringify(data).slice(0, 200)}`);
}

Prevention

When it happens

Trigger: Parsed JSON where `data` is missing, not an array, or empty. Happens when the API returns a partial/empty success body (e.g. an internal moderation swallow with 2xx), an unexpected envelope from a `baseUrl` override, or a model that returned no candidates.

Common situations: (1) Prompt tripped moderation but the API returned 2xx with empty `data`; (2) wrong API path/version returning a different envelope; (3) transient provider issue producing zero candidates.

Related errors


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