gitroomhq/postiz-app · error · Error

Video generation failed (status ${successFlag})

Error message

Video generation failed (status ${successFlag})

What it means

The record-info payload carries successFlag: 0=generating, 1=success, anything else=failed. When successFlag is another value, the code throws the provider's errorMessage or 'Video generation failed (status ${successFlag})'. This is the provider reporting the generation itself failed.

Source

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

          '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');
      }

      await timer(10000);
    }
  }
}

View on GitHub (pinned to 0f1647f749)

Solutions

  1. Read the errorMessage in the thrown error — it usually states the provider reason (e.g. 'content policy violation')
  2. Rephrase the prompt to avoid flagged content and retry
  3. Check kie.ai status/changelog for model incidents
  4. If failure is persistent with valid prompts, escalate to the provider with the taskId

Example fix

// before
throw new Error(data?.data?.errorMessage || `Video generation failed (status ${successFlag})`);

// after: surface taskId for support
throw new Error(
  `${data?.data?.errorMessage || `Video generation failed (status ${successFlag})`} [taskId=${taskId}]`
);
Defensive patterns

Strategy: fallback

Validate before calling

const RISKY = /celebrity|nsfw|gore/i;
const isSafePrompt = (p: string): boolean => !RISKY.test(p);

Type guard

const isSafePrompt = (p: string): boolean => !RISKY.test(p);

Try / catch

try { await veo3.process(prompt); } catch (e) { if (/Video generation failed|content policy/i.test(String(e))) return suggestRewriteToUser(e); throw e; }

Prevention

When it happens

Trigger: Content moderation rejecting the prompt, model errors (NSFW filter, unsafe content, internal model crash), resource limits on the provider, or a malformed request that passed initial validation but failed in the pipeline.

Common situations: Prompts involving people/celebrities/branded content tripping filters; provider model outages; requests with unsupported camera/style parameters.

Related errors


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