yikart/AiToEarn · error · InstagramPlatformException
ChannelPlatformMediaProcessingFailed
ChannelPlatformMediaProcessingFailed
Error message
ChannelPlatformMediaProcessingFailed
What it means
An Instagram media container finished processing with an Error or Expired status instead of FINISHED. The media (image/video/story) can't be published from that container, so the provider throws ChannelPlatformMediaProcessingFailed.
Source
Thrown at project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/instagram/instagram-publish.provider.ts:436
let lastStatus: Awaited<ReturnType<InstagramService['getMediaContainerStatus']>> | undefined
await poll(
async () => {
const status = await this.instagramService.getMediaContainerStatus(
accessToken,
containerId,
)
lastStatus = status
if (status.statusCode === InstagramMediaContainerStatusCode.Finished) {
return { done: true, data: true }
}
if (
status.statusCode === InstagramMediaContainerStatusCode.Error
|| status.statusCode === InstagramMediaContainerStatusCode.Expired
) {
throw new InstagramPlatformException({
code: ResponseCode.ChannelPlatformMediaProcessingFailed,
category: PlatformErrorCategory.MediaProcessingFailed,
context: {
endpoint: 'waitForContainerReady',
platformWorkId: containerId,
metadata: { statusCode: status.statusCode, status: status.status },
},
cause: {
type: PlatformErrorCauseType.Platform,
platformCode: status.statusCode,
platformMessage: status.status,
raw: status,
},
})
}
return { done: false }
},View on GitHub (pinned to d3aa8bea5b)
Solutions
- Check status.status in the error context for Instagram's error message
- Re-encode video to meet Instagram specs (H.264, AAC, 3-60s reels limits) and re-upload
- Ensure the media URL is publicly reachable and not expiring quickly
- Recreate the container promptly and publish immediately instead of reusing old containers
Defensive patterns
Strategy: retry
Validate before calling
// validate video specs before container creation
if (!['H.264','H264'].includes(video.codec) || video.durationSeconds > 60 || video.durationSeconds < 3) {
throw new Error('Video does not meet Instagram reels specs')
} Type guard
function isTerminalFailure(statusCode: string): boolean {
return statusCode === 'ERROR' || statusCode === 'EXPIRED'
} Try / catch
try {
await provider.publish(input)
} catch (e) {
if (e.code === 'ChannelPlatformMediaProcessingFailed') {
const { statusCode, status } = e.context.metadata
logger.error('IG container failed', { statusCode, status })
// ERROR/EXPIRED containers are not retryable as-is: recreate container with fixed media
await recreateContainerAndRepublish(input)
} else throw e
} Prevention
- Re-encode media to Instagram specs before upload
- Keep media URLs long-lived and publicly reachable
- Publish soon after container creation to avoid EXPIRED
- Surface status.status from the error context to diagnose content rejections
When it happens
Trigger: waitForContainerReady (polling loop used by publishSingleImage, publishCarousel, publishVideo, publishStory) reads the container status and sees status.statusCode === Error or Expired.
Common situations: Video violates Instagram reels/IGTV specs (codec, aspect ratio, duration); media URL unreachable or expired before Instagram downloaded it; container was created long before publishing and expired; copyrighted/blocked content.
Related errors
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/7b02681078d3a178.
Report an issue: GitHub.