{"record":{"id":"0585a452c6a6cb95","repo":"nexu-io/open-design","slug":"volcengine-image-response-had-no-data-0","errorCode":null,"errorMessage":"volcengine image response had no data[0]","messagePattern":"volcengine image response had no data\\[0\\]","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/media/index.ts","lineNumber":1576,"sourceCode":"    method: 'POST',\n    headers: {\n      'authorization': `Bearer ${credentials.apiKey}`,\n      'content-type': 'application/json',\n    },\n    body: JSON.stringify(body),\n  }));\n  const text = await resp.text();\n  if (!resp.ok) {\n    throw new Error(`volcengine image ${resp.status}: ${truncate(text, 240)}`);\n  }\n  let data: any;\n  try {\n    data = JSON.parse(text);\n  } catch {\n    throw new Error(`volcengine image non-JSON: ${truncate(text, 200)}`);\n  }\n  const entry = data && Array.isArray(data.data) ? data.data[0] : null;\n  if (!entry) throw new Error('volcengine image response had no data[0]');\n  let bytes;\n  if (entry.b64_json) {\n    bytes = Buffer.from(entry.b64_json, 'base64');\n  } else if (entry.url) {\n    const imgResp = await fetch(entry.url, withMediaRequestInit(ctx));\n    if (!imgResp.ok) throw new Error(`volcengine image fetch ${imgResp.status}`);\n    bytes = Buffer.from(await imgResp.arrayBuffer());\n  } else {\n    throw new Error('volcengine image response missing b64_json/url');\n  }\n  return {\n    bytes,\n    providerNote: `volcengine/${ctx.wireModel} · ${ctx.aspect} · ${bytes.length} bytes`,\n    suggestedExt: '.png',\n  };\n}\n\n// ---------------------------------------------------------------------------","sourceCodeStart":1558,"sourceCodeEnd":1594,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/media/index.ts#L1558-L1594","documentation":"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.","triggerScenarios":"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.","commonSituations":"(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.","solutions":["Retry once with a reworded prompt to rule out moderation.","Inspect the full parsed body for an embedded `error`/`message` explaining the empty `data`.","Confirm the API path is `/api/v3/images/generations` and the model is activated."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function hasVolcengineImageEntry(d: unknown): d is { data: Array<{ b64_json?: string; url?: string }> } {\n  return Array.isArray((d as any)?.data) && (d as any).data.length > 0;\n}\nif (!hasVolcengineImageEntry(data)) {\n  throw new Error(`volcengine image response had no data[0]: ${JSON.stringify(data).slice(0, 200)}`);\n}","tryCatchPattern":null,"preventionTips":["Retry once with a reworded prompt to rule out a moderation swallow.","Inspect the full body for an embedded `error` when `data` is empty.","Confirm the API path/version matches the expected Seedream envelope."],"tags":["volcengine","ark","seedream","response-shape"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}