jackwener/OpenCLI · error · CommandExecutionError

Instagram private mixed-media publish does not support readi

Error message

Instagram private mixed-media publish does not support reading video metadata on ${process.platform}

What it means

readVideoMetadata uses AVFoundation via an inline Swift script, so it only works on macOS (darwin). On any other platform the function throws immediately at clis/instagram/_shared/private-publish.js:427, telling you to use macOS or the UI fallback. This is an explicit platform guard, not a runtime fault.

Source

Thrown at clis/instagram/_shared/private-publish.js:427

                .map((value) => String(value || '').trim())
                .filter(Boolean)
                .join(' ');
            throw new CommandExecutionError(`Instagram private publish failed to ${stage}`, detail || 'swift helper failed');
        }
        return JSON.parse(String(result.stdout || '{}'));
    }
    catch (error) {
        if (error instanceof CommandExecutionError)
            throw error;
        throw new CommandExecutionError(`Instagram private publish failed to ${stage}`, error instanceof Error ? error.message : String(error));
    }
    finally {
        fs.rmSync(scriptPath, { force: true });
    }
}
function readVideoMetadata(filePath) {
    if (process.platform !== 'darwin') {
        throw new CommandExecutionError(`Instagram private mixed-media publish does not support reading video metadata on ${process.platform}`, 'Use macOS for private mixed-media publishing, or rely on the UI fallback');
    }
    const metadata = runSwiftJsonScript(`
import AVFoundation
import Foundation

let path = CommandLine.arguments[1]
let url = URL(fileURLWithPath: path)
let asset = AVURLAsset(url: url)
guard let track = asset.tracks(withMediaType: .video).first else {
  fputs("{\\"error\\":\\"missing-video-track\\"}", stderr)
  exit(1)
}
let transformed = track.naturalSize.applying(track.preferredTransform)
let width = Int(abs(transformed.width.rounded()))
let height = Int(abs(transformed.height.rounded()))
let durationMs = Int((CMTimeGetSeconds(asset.duration) * 1000.0).rounded())
let payload: [String: Int] = [
  "width": width,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run the private mixed-media publish on a macOS machine
  2. Use the UI-based publish flow which has a non-Swift fallback for video metadata
  3. Short-circuit in your own code: check process.platform === 'darwin' before invoking the private publisher

Example fix

// before
const meta = await metadata(filePath);
// after
if (process.platform !== 'darwin') throw new Error('Private mixed-media publish requires macOS');
const meta = await metadata(filePath);
Defensive patterns

Strategy: validation

Validate before calling

if (process.platform !== 'darwin') {
  throw new Error('Private mixed-media publish requires macOS for video metadata');
}

Type guard

const isMac = () => process.platform === 'darwin';

Try / catch

try { const meta = await metadata(videoPath); }
catch (e) {
  if (/does not support reading video metadata/.test(e.message)) return useUiFallback();
  throw e;
}

Prevention

When it happens

Trigger: Calling metadata (via readVideoMetadata) for a private mixed-media publish while process.platform is 'linux' or 'win32'.

Common situations: CI pipelines running the private publisher on Linux Docker images; developers on Windows trying to publish mixed photo/video carousels privately; switching machines/containers after developing on a Mac.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/1fd4b99eec67c342. Report an issue: GitHub.