{"record":{"id":"c6f67b5f6a9aa3a5","repo":"gitroomhq/postiz-app","slug":"x-failed-to-process-the-uploaded-video-processin","errorCode":null,"errorMessage":"X failed to process the uploaded video${(processing as any)?.error?.message ? `: ${(processing as any).error.message}` : ''}","messagePattern":"X failed to process the uploaded video(.+?)` : ''\\}","errorType":"exception","errorClass":"BadBody","httpStatus":null,"severity":"error","filePath":"libraries/nestjs-libraries/src/integrations/social/x.provider.ts","lineNumber":565,"sourceCode":"          media: await this.mediaChunk(path, start, end, this.identifier),\n        },\n        { forceBodyMode: 'form-data' }\n      );\n    }\n\n    setHeartbeatDetails(`x: upload finalize media=${mediaId}`);\n    const finalize = await client.v2.post<{\n      data: {\n        id: string;\n        processing_info?: { state: string; check_after_secs?: number };\n      };\n    }>(`media/upload/${mediaId}/finalize`);\n\n    const processing = finalize.data.processing_info;\n\n    // An explicit rejection right at finalize: the video will never process.\n    if (processing?.state === 'failed') {\n      throw new BadBody(\n        this.identifier,\n        JSON.stringify(processing),\n        Buffer.from('{}'),\n        `X failed to process the uploaded video${\n          (processing as any)?.error?.message\n            ? `: ${(processing as any).error.message}`\n            : ''\n        }`\n      );\n    }\n\n    // Per the docs a missing processing_info means the media is ready to use;\n    // anything else keeps transcoding asynchronously and must reach\n    // `succeeded` before the media_id can be attached to a post.\n    return {\n      mediaId,\n      processing: !!processing && processing.state !== 'succeeded',\n    };","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/gitroomhq/postiz-app/blob/0f1647f7491a217d43eb5ae7a480484bdf0aff3e/libraries/nestjs-libraries/src/integrations/social/x.provider.ts#L547-L583","documentation":"Right after finalizing a chunked video upload, X's finalize response reports processing_info.state === 'failed'. This is an explicit, permanent rejection: the video will never process, so it throws BadBody with X's error message when available.","triggerScenarios":"POST media/upload/{id}/finalize returns processing_info with state 'failed': unsupported video codec/container, media too long or too large, corrupted chunk data, or X's transcoder rejecting the file.","commonSituations":"Videos in exotic codecs (e.g. some .mov/hevc variants), exceeded X's duration/size limits, chunked upload where a chunk was corrupted in transit.","solutions":["Re-encode the video to H.264 MP4 + AAC within X's duration/size limits and re-upload","Check the JSON processing_info in the error body for X's specific error code","Verify chunk sizes/offsets were exact if you control the upload loop","Retry once — occasional transcoder glitches do happen"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// validate video before uploading to X\nconst okVideo = file.mimetype === 'video/mp4' && durationSec <= 140 && sizeMB <= 512;\nif (!okVideo) { /* transcode or reject before upload */ }","typeGuard":"const isFailedProcessing = (p?: { state?: string }) => p?.state === 'failed';","tryCatchPattern":"catch (e) { if (e instanceof BadBody && e.message.includes('process the uploaded video')) { const info = JSON.parse(String(e.body)); /* read info.error, re-encode media, retry */ } throw e; }","preventionTips":["Re-encode videos to H.264 MP4 + AAC within X limits before scheduling","Keep chunk boundaries exact in chunked uploads","Inspect processing_info.error for the authoritative reason instead of guessing"],"tags":["x-twitter","video-upload","processing-failed","transcode"],"backgroundTag":"social-media-upload-rejected","analyzedSha":"0f1647f7491a217d43eb5ae7a480484bdf0aff3e","analyzedAt":"2026-08-27T12:09:55.020Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}