yikart/AiToEarn · error · PinterestPlatformException
ChannelPlatformMediaProcessingFailed
ChannelPlatformMediaProcessingFailed
Error message
ChannelPlatformMediaProcessingFailed
What it means
ChannelPlatformMediaProcessingFailed is raised when Pinterest reports that an uploaded video media asset ended in the Failed state during uploadVideo polling. The provider polls getMediaStatus until Succeeded; if Pinterest returns Failed it wraps it in a PinterestPlatformException with the MediaProcessingFailed category. The video cannot be used for pin creation.
Source
Thrown at project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/pinterest/pinterest-publish.provider.ts:248
await this.mediaService.withUploadSource({
platform: this.platform,
endpoint: 'uploadVideo.downloadMedia',
url: videoUrl,
}, async (source) => {
await this.pinterestService.uploadVideoMedia(upload, await source.blob(), source.filename)
})
let lastStatus: Awaited<ReturnType<PinterestService['getMediaStatus']>> | undefined
return await poll(
async () => {
const status = await this.pinterestService.getMediaStatus(accessToken, upload.media_id)
lastStatus = status
if (status.status === PinterestMediaStatusValue.Succeeded) {
return { done: true, data: upload.media_id }
}
if (status.status === PinterestMediaStatusValue.Failed) {
throw new PinterestPlatformException({
code: ResponseCode.ChannelPlatformMediaProcessingFailed,
category: PlatformErrorCategory.MediaProcessingFailed,
context: {
endpoint: 'uploadVideo',
metadata: { mediaId: upload.media_id, status: status.status },
},
cause: {
type: PlatformErrorCauseType.Platform,
platformCode: status.status,
raw: status,
},
})
}
return { done: false }
},
{
intervalMs: 5000,
maxPollingMs: 5 * 60 * 1000,View on GitHub (pinned to d3aa8bea5b)
Solutions
- Re-encode the video to Pinterest-supported specs (MP4, H.264/AAC) and retry
- Check Pinterest media limits (aspect ratio, duration, file size) and trim/compress the file
- Inspect the logged mediaId/status metadata, re-upload a fresh asset rather than reusing media_id
- Verify the source file is not corrupted before upload
Example fix
// before
await uploadVideo(accessToken, corruptedClip) // polls -> Failed -> ChannelPlatformMediaProcessingFailed
// after
const fixed = await transcodeToMp4H264(corruptedClip, { maxDurationSec: 900 })
await uploadVideo(accessToken, fixed) Defensive patterns
Strategy: retry
Validate before calling
const PINTEREST_MAX = { width: 1024, height: 1024, durationSec: 900, sizeMB: 2000 }
function validatePinterestVideo(v: { codec: string; container: string; durationSec: number; sizeMB: number }): boolean {
return v.codec === 'h264' && v.container === 'mp4' && v.durationSec <= PINTEREST_MAX.durationSec && v.sizeMB <= PINTEREST_MAX.sizeMB
} Type guard
function isPinterestMediaStatusFailed(status: { status: string }): boolean {
return status.status === 'Failed'
} Try / catch
try {
const mediaId = await provider.uploadVideo(accessToken, file)
} catch (e) {
if (e instanceof PinterestPlatformException && e.code === ResponseCode.ChannelPlatformMediaProcessingFailed) {
const fixed = await transcodeToMp4H264(file)
mediaId = await provider.uploadVideo(accessToken, fixed) // retry once with re-encoded asset
} else throw e
} Prevention
- Pre-encode to MP4/H.264/AAC before uploading
- Enforce Pinterest duration/aspect/size limits at ingest
- Log mediaId + status metadata (already in context) to diagnose failures
- Re-upload fresh assets instead of reusing a failed media_id
When it happens
Trigger: uploadVideo() polling loop observes status.status === PinterestMediaStatusValue.Failed for the media_id — Pinterest's transcode/processing rejected the asset (bad codec, corrupt file, exceeds size/duration limits).
Common situations: Uploading videos with unsupported codecs/containers (e.g. non-H.264), files exceeding Pinterest's limits, truncated uploads, or very long videos that fail transcoding server-side.
Related errors
- VideoUploadVidNotFound
- Relay uploadSign returned no uploadUrl: ${JSON.stringify(sig
- ChannelPlatformMediaProcessingFailed
- ChannelPlatformResponseInvalid
- ChannelPlatformMediaProcessingFailed
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/2bff0e2b0d29d7a6.
Report an issue: GitHub.