{"record":{"id":"047655b0c7cefa66","repo":"nexu-io/open-design","slug":"volcengine-poll-pollresp-status-truncate-pol","errorCode":null,"errorMessage":"volcengine poll ${pollResp.status}: ${truncate(pollText, 240)}","messagePattern":"volcengine poll (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/media/index.ts","lineNumber":1488,"sourceCode":"  let lastStatus = '';\n  // Emit a \"task accepted\" line right away so the agent's chat shows\n  // something within the first second instead of going silent for the\n  // full poll loop. cc's Bash tool considers a long-quiet pipe stuck\n  // and times out at ~2 minutes — Volcengine i2v routinely takes\n  // 3-5 minutes, so without this stream, every i2v dispatch dies\n  // mid-flight.\n  if (typeof onProgress === 'function') {\n    const mode = ctx.imageRef ? 'i2v' : 't2v';\n    onProgress(`volcengine ${mode} task ${taskId} accepted; polling status…`);\n  }\n  while (Date.now() - startedAt < maxMs) {\n    await sleep(4000);\n    const pollResp = await fetch(`${baseUrl}/contents/generations/tasks/${encodeURIComponent(taskId)}`, withMediaRequestInit(ctx, {\n      headers: { 'authorization': `Bearer ${credentials.apiKey}` },\n    }));\n    const pollText = await pollResp.text();\n    if (!pollResp.ok) {\n      throw new Error(`volcengine poll ${pollResp.status}: ${truncate(pollText, 240)}`);\n    }\n    let pollData: any;\n    try {\n      pollData = JSON.parse(pollText);\n    } catch {\n      throw new Error(`volcengine poll non-JSON: ${truncate(pollText, 200)}`);\n    }\n    lastStatus = pollData.status || '';\n    // Forward each poll tick. Heartbeat doubles as a \"command is alive\"\n    // signal for the agent's bash tool — the daemon's SSE stream emits\n    // an event for every line, which cc renders into the chat as live\n    // output so its watchdog never marks the call as hung.\n    if (typeof onProgress === 'function') {\n      const elapsedSec = Math.round((Date.now() - startedAt) / 1000);\n      onProgress(`volcengine task ${taskId} status=${lastStatus || 'pending'} (elapsed ${elapsedSec}s)`);\n    }\n    if (lastStatus === 'succeeded') {\n      videoUrl = pollData?.content?.video_url || null;","sourceCodeStart":1470,"sourceCodeEnd":1506,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/media/index.ts#L1470-L1506","documentation":"Thrown when polling `GET /api/v3/contents/generations/tasks/{id}` returns a non-2xx status. Unlike creation failures, a poll failure is often transient (rate-limited polling, momentary 5xx), so the status+body are surfaced for triage.","triggerScenarios":"`pollResp.ok === false` during the 4-second-interval poll loop. Causes: 429 from polling too aggressively for the account tier, 401 from a key invalidated mid-render, 404 if the task id expired, or transient 5xx from the Ark service.","commonSituations":"(1) Polling rate limit on lower ARK tiers; (2) long-running i2v task outliving key validity; (3) transient Volcengine 5xx mid-render.","solutions":["Retry the whole render — transient poll 5xx/429 usually clear on the next attempt.","If consistently 429, the 4s poll interval may exceed the tier's allowance; reduce concurrency.","On 401/404, restart with a fresh key — the task id is no longer usable."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Poll failures are usually transient — retry the whole render once.\ntry {\n  return await renderVolcengineVideo(ctx, credentials, onProgress);\n} catch (err) {\n  const msg = err instanceof Error ? err.message : String(err);\n  if (/poll 5\\d{2}|poll 429/.test(msg)) { return await renderVolcengineVideo(ctx, credentials, onProgress); }\n  throw err;\n}","preventionTips":["Treat mid-render poll 5xx/429 as retryable, not fatal.","Watch for keys invalidated mid-render on long i2v tasks.","Keep concurrency low enough to stay under the ARK tier's poll allowance."],"tags":["volcengine","ark","seedance","video","polling"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}