nexu-io/open-design · error · Error

volcengine image ${resp.status}: ${truncate(text, 240)}

Error message

volcengine image ${resp.status}: ${truncate(text, 240)}

What it means

Thrown when the Seedream `POST /api/v3/images/generations` returns a non-2xx status. The message carries the HTTP status plus up to 240 chars of body, surfacing the Volcengine error (auth, model-not-enabled, invalid size/aspect).

Source

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

    model: ctx.wireModel,
    prompt: ctx.prompt || 'A high-quality reference image.',
    response_format: 'b64_json',
    // openaiSizeFor branches on the catalog id (gpt-image-* vs dall-e-*
    // accept different size enums), so it must NOT see the post-alias
    // wire name. lefarcen + codex P2 on PR #1309.
    size: openaiSizeFor(ctx.model, ctx.aspect),
  };
  const resp = await fetch(`${baseUrl}/images/generations`, withMediaRequestInit(ctx, {
    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');

View on GitHub (pinned to 5be4028344)

Solutions

  1. Inspect the embedded status+body: 401 → fix key; 403/'permission denied' → enable the Seedream model in the Volcengine console; 400 → adjust aspect; 429 → wait for quota reset.
  2. Ensure `ctx.wireModel` matches an activated Ark endpoint id or model name.
  3. Confirm the `baseUrl` resolves to the correct regional Ark host.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return await renderVolcengineImage(ctx, credentials);
} catch (err) {
  const msg = err instanceof Error ? err.message : String(err);
  if (/image 40[13]/.test(msg)) { throw new Error('Volcengine auth failed — check ARK_API_KEY'); }
  if (/permission|forbidden/i.test(msg)) { throw new Error('Seedream model not activated for this account'); }
  if (/image 429/.test(msg)) { /* quota — back off */ }
  throw err;
}

Prevention

When it happens

Trigger: `resp.ok === false` on the Seedream image call. Concretely: 401 from a wrong/expired ARK key, 403/permission-denied because the Seedream model isn't activated, 400 from an unsupported `size`/`aspect` mapping (via `openaiSizeFor`), or 429 quota exhaustion.

Common situations: (1) ARK key valid but Seedream model not subscribed/activated in the Volcengine console; (2) aspect ratio not mappable to a supported size; (3) account out of image quota; (4) `baseUrl` overridden to a region that doesn't host the model.

Related errors


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