{"record":{"id":"065f98fe30757ee4","repo":"gitroomhq/postiz-app","slug":"video-generation-failed-status-successflag","errorCode":null,"errorMessage":"Video generation failed (status ${successFlag})","messagePattern":"Video generation failed \\(status (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"libraries/nestjs-libraries/src/videos/veo3/veo3.ts","lineNumber":95,"sourceCode":"          'https://api.kie.ai/api/v1/veo/record-info?taskId=' + taskId,\n          {\n            headers: {\n              'Content-Type': 'application/json',\n              Authorization: `Bearer ${process.env.KIEAI_API_KEY}`,\n            },\n            signal: AbortSignal.timeout(30000),\n          }\n        )\n      ).json();\n\n      if (data.code !== 200) {\n        throw new Error(data?.msg || `Failed to get video info`);\n      }\n\n      // successFlag: 0 = generating, 1 = success, anything else = failed\n      const successFlag = data?.data?.successFlag;\n      if (successFlag !== 0 && successFlag !== 1) {\n        throw new Error(\n          data?.data?.errorMessage ||\n            `Video generation failed (status ${successFlag})`\n        );\n      }\n\n      const videoUrl = data?.data?.response?.resultUrls || [];\n      if (videoUrl.length > 0) {\n        return videoUrl[0];\n      }\n\n      if (successFlag === 1) {\n        throw new Error('Video generation succeeded but no video URL returned');\n      }\n\n      await timer(10000);\n    }\n  }\n}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/libraries/nestjs-libraries/src/videos/veo3/veo3.ts#L77-L113","documentation":"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.","triggerScenarios":"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.","commonSituations":"Prompts involving people/celebrities/branded content tripping filters; provider model outages; requests with unsupported camera/style parameters.","solutions":["Read the errorMessage in the thrown error — it usually states the provider reason (e.g. 'content policy violation')","Rephrase the prompt to avoid flagged content and retry","Check kie.ai status/changelog for model incidents","If failure is persistent with valid prompts, escalate to the provider with the taskId"],"exampleFix":"// before\nthrow new Error(data?.data?.errorMessage || `Video generation failed (status ${successFlag})`);\n\n// after: surface taskId for support\nthrow new Error(\n  `${data?.data?.errorMessage || `Video generation failed (status ${successFlag})`} [taskId=${taskId}]`\n);","handlingStrategy":"fallback","validationCode":"const RISKY = /celebrity|nsfw|gore/i;\nconst isSafePrompt = (p: string): boolean => !RISKY.test(p);","typeGuard":"const isSafePrompt = (p: string): boolean => !RISKY.test(p);","tryCatchPattern":"try { await veo3.process(prompt); } catch (e) { if (/Video generation failed|content policy/i.test(String(e))) return suggestRewriteToUser(e); throw e; }","preventionTips":["Pre-filter prompts for obviously filtered content","Surface provider errorMessage to users so they can adjust","Keep taskId in error reports for provider escalation"],"tags":["veo3","video-generation","content-moderation","upstream"],"backgroundTag":"video-generation-failed","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}