gitroomhq/postiz-app · error · Error

Failed to get video info

Error message

Failed to get video info

What it means

Each poll of the kie.ai record-info endpoint checks for code 200; any other code (auth failure, unknown taskId, rate limit, provider error) throws data.msg or 'Failed to get video info'. It's distinct from generation failure — it means the status query itself failed.

Source

Thrown at libraries/nestjs-libraries/src/videos/veo3/veo3.ts:89

        throw new Error('Video generation timed out');
      }

      console.log('waiting for video to be ready');
      const data = await (
        await fetch(
          'https://api.kie.ai/api/v1/veo/record-info?taskId=' + taskId,
          {
            headers: {
              'Content-Type': 'application/json',
              Authorization: `Bearer ${process.env.KIEAI_API_KEY}`,
            },
            signal: AbortSignal.timeout(30000),
          }
        )
      ).json();

      if (data.code !== 200) {
        throw new Error(data?.msg || `Failed to get video info`);
      }

      // successFlag: 0 = generating, 1 = success, anything else = failed
      const successFlag = data?.data?.successFlag;
      if (successFlag !== 0 && successFlag !== 1) {
        throw new Error(
          data?.data?.errorMessage ||
            `Video generation failed (status ${successFlag})`
        );
      }

      const videoUrl = data?.data?.response?.resultUrls || [];
      if (videoUrl.length > 0) {
        return videoUrl[0];
      }

      if (successFlag === 1) {
        throw new Error('Video generation succeeded but no video URL returned');

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Retry the status call after a short backoff before giving up (transient 5xx/rate limits are common)
  2. Confirm the API key is still valid and the taskId exists (log both when throwing)
  3. Add jitter/backoff to the 10s polling to avoid rate limits
  4. If the record is truly gone (invalid taskId), restart the generation from scratch

Example fix

// before
if (data.code !== 200) {
  throw new Error(data?.msg || 'Failed to get video info');
}

// after
if (data.code !== 200) {
  if (data.code >= 500 || data.code === 429) { await timer(15000); continue; }
  throw new Error(data?.msg || `Failed to get video info (code=${data.code})`);
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try { await veo3.process(prompt); } catch (e) { if (/Failed to get video info/.test(String(e))) { await sleep(15000); return veo3.process(prompt); } throw e; }

Prevention

When it happens

Trigger: GET api.kie.ai/api/v1/veo/record-info?taskId=... returning non-200: invalid API key mid-job, task expired/evicted from provider's store, rate limiting from the 10-second polling loop, or transient provider 5xx.

Common situations: API key rotated while a generation was in-flight; polling too aggressively hitting rate limits; provider pruning task records before completion; transient network errors surfacing as non-200 codes.

Related errors


AI-assisted analysis of gitroomhq/postiz-app@0f1647f749 (2026-08-27). Data as JSON: /api/errors/7e751c28ee83ef66. Report an issue: GitHub.