jackwener/OpenCLI · warning
Browser Bridge reported ${downloaded.mime} for ${sourcePath}
Error message
Browser Bridge reported ${downloaded.mime} for ${sourcePath}; detected ${actualMime} from file bytes What it means
After copying media produced by the Browser Bridge, the MIME the bridge reported for the downloaded file differs from the type sniffed from the file's bytes. The sniffed type already matched the expected config.mime (a mismatch would have thrown), so this warns that the bridge's reported metadata was wrong and continues the atomic move into place.
Source
Thrown at clis/midjourney/utils.js:782
if (!sourceStat?.isFile() || sourceStat.size <= 0) {
throw new CommandExecutionError(`Browser reported a completed download but the file is missing: ${sourcePath}`);
}
const handle = await fs.open(sourcePath, 'r');
let actualMime;
try {
const header = Buffer.alloc(16);
const { bytesRead } = await handle.read(header, 0, header.length, 0);
actualMime = sniffMediaMime(header.subarray(0, bytesRead));
} finally {
await handle.close();
}
if (actualMime !== config.mime) {
throw new CommandExecutionError(
`Midjourney ${kind} returned invalid media bytes; expected ${config.mime}, detected ${actualMime || 'unknown'}`,
);
}
if (downloaded.mime && downloaded.mime !== actualMime) {
log.warn(`Browser Bridge reported ${downloaded.mime} for ${sourcePath}; detected ${actualMime} from file bytes`);
}
const tempPath = `${filePath}.part-${process.pid}-${Date.now()}`;
try {
await fs.copyFile(sourcePath, tempPath);
await fs.rename(tempPath, filePath);
if (sourcePath !== filePath) await fs.unlink(sourcePath).catch(() => {});
} catch (error) {
await fs.unlink(tempPath).catch(() => {});
throw new CommandExecutionError(`Could not store Midjourney ${kind} at ${filePath}: ${errorMessage(error)}`);
}
return {
index,
kind,
filePath,
bytes: sourceStat.size,
url: stringOrNull(downloaded.finalUrl ?? downloaded.url),
mime: actualMime,
cached: false,View on GitHub (pinned to 49907e53dc)
Solutions
- No action needed if the output file is valid — the byte-level check passed
- Update the browser extension to v1.6+ (CDP-based upload/download fixes metadata reporting)
- Verify the saved file opens/plays with the expected type
- Re-run the download if the file is unexpectedly corrupt
Example fix
// before: outdated extension misreports mime // warn: Browser Bridge reported application/octet-stream for /tmp/x.jpg; detected image/jpeg // after // Update extension to v1.6+ so reported mime matches detected bytes
Defensive patterns
Strategy: validation
Validate before calling
const actual = sniffMediaMime(fs.readFileSync(sourcePath));
if (actual !== expectedMime) throw new Error(`Bridge file mime mismatch: ${actual}`); Type guard
const matches = (downloaded, actual) => !downloaded.mime || downloaded.mime === actual;
Try / catch
try {
await downloadRenderedVideo(page, jobId, index, kind, dir);
} catch (err) {
if (/invalid media bytes/.test(err.message)) { /* retry; consider updating the extension */ }
} Prevention
- Keep the browser extension at v1.6+ so reported MIME is reliable
- Validate bytes, not just reported metadata, before moving files into place
- Use atomic .part-file renames as the library does
- Spot-check downloaded files with a MIME probe in CI
When it happens
Trigger: Browser Bridge downloads a Midjourney image/video to a temp path; downloaded.mime is set and differs from sniffMediaMime of the file contents, while the actual bytes match the required type.
Common situations: Older extension versions reporting default or generic MIME types, browser assigning Content-Type from the URL extension, bridge download interception layer mislabeling files.
Related errors
- Browser Bridge download lifecycle support is required for so
- Browser Bridge does not support Reference drag-and-drop
- Browser Bridge native click support is required for Creation
- Midjourney CDN reported ${media.mime || 'unknown'} for ${res
- Midjourney CDN reported ${media.mime || 'unknown'} for ${url
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e6c07c48c841aec9.
Report an issue: GitHub.