jackwener/OpenCLI · warning
Midjourney CDN reported ${media.mime || 'unknown'} for ${url
Error message
Midjourney CDN reported ${media.mime || 'unknown'} for ${url}; detected ${actualMime} from file bytes What it means
When downloading a raw Midjourney video, the CDN-reported Content-Type disagreed with the MP4 type detected from the file bytes. The bytes were validated as video/mp4 (otherwise it would throw), so this is only a warning before the buffer is written to disk.
Source
Thrown at clis/midjourney/utils.js:723
} catch (error) {
await fs.unlink(tempPath).catch(() => {});
throw new CommandExecutionError(`Could not write Midjourney media ${filePath}: ${errorMessage(error)}`);
}
}
export async function downloadRawVideo(page, jobId, index, outputDir, force = false) {
await fs.mkdir(outputDir, { recursive: true });
const url = rawVideoUrl(jobId, index);
const filePath = path.join(outputDir, `${jobId}_${index + 1}_raw.mp4`);
const existing = await existingMedia(filePath, force, 'video/mp4');
if (existing) return { index, kind: 'video-raw', filePath, bytes: existing.size, url, mime: 'video/mp4', cached: true };
const media = await fetchMediaThroughPage(page, url, 'video/');
const actualMime = sniffMediaMime(media.buffer);
if (actualMime !== 'video/mp4') {
throw new CommandExecutionError(`Midjourney raw video returned invalid MP4 bytes from ${url}`);
}
if (media.mime !== actualMime) {
log.warn(`Midjourney CDN reported ${media.mime || 'unknown'} for ${url}; detected ${actualMime} from file bytes`);
}
await writeMediaBuffer(filePath, media.buffer);
return { index, kind: 'video-raw', filePath, bytes: media.buffer.length, url, mime: actualMime, cached: false };
}
export async function downloadRenderedVideo(page, jobId, index, kind, outputDir, force = false) {
const config = kind === 'video-social'
? { label: 'Download for Social', extension: '.mp4', mime: 'video/mp4' }
: kind === 'gif'
? { label: 'Download as GIF', extension: '.gif', mime: 'image/gif' }
: null;
if (!config) throw new ArgumentError('Rendered video kind must be video-social or gif');
await fs.mkdir(outputDir, { recursive: true });
const filePath = path.join(outputDir, `${jobId}_${index + 1}_${kind.replace('video-', '')}${config.extension}`);
const existing = await existingMedia(filePath, force, config.mime);
if (existing) return { index, kind, filePath, bytes: existing.size, url: null, mime: config.mime, cached: true };
await page.goto(jobUrl(jobId, index));View on GitHub (pinned to 49907e53dc)
Solutions
- No action required if the saved .mp4 plays correctly — bytes were validated as MP4
- Verify the output file with a media probe (ffprobe) if in doubt
- Check for proxies altering response headers
- Report persistent mismatches for a specific URL/region to the library maintainers
Defensive patterns
Strategy: validation
Validate before calling
const actual = sniffMediaMime(buffer);
if (actual !== 'video/mp4') throw new Error(`Expected video/mp4, got ${actual}`); Type guard
const isMp4 = (m) => m === 'video/mp4';
Try / catch
try {
await downloadRawVideo(page, jobId, index);
} catch (err) {
if (/invalid MP4 bytes/.test(err.message)) { /* retry or fetch alternate rendition */ }
} Prevention
- Validate the sniffed MIME (video/mp4) before persisting files
- Play/probe output .mp4 files after batch downloads
- Route downloads around header-rewriting proxies/CDNs
- Log header-vs-sniff mismatches to spot persistently mislabeled CDN paths
When it happens
Trigger: fetchMediaThroughPage retrieves a raw video URL and media.mime (response header) differs from sniffMediaMime(buffer) which returned video/mp4.
Common situations: CDN serving videos with application/octet-stream or wrong Content-Type, browser-bridge page fetch reporting a generic MIME, CDN transcode/edge-cache misconfiguration.
Related errors
- Midjourney CDN reported ${media.mime || 'unknown'} for ${res
- ${capabilities.plan || 'current'} plan does not support HD v
- Video jobs support video-raw, video-social, or gif downloads
- Midjourney media download failed: HTTP ${payload?.status ??
- Midjourney media download returned unexpected content type "
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/192ea6801e1a9f19.
Report an issue: GitHub.