jackwener/OpenCLI · error · CommandExecutionError

Instagram private publish does not support auto-normalizing

Error message

Instagram private publish does not support auto-normalizing ${asset.fileName} on ${process.platform}

What it means

Feed images outside Instagram's allowed aspect ratio must be padded to normalized dimensions. Padding uses the macOS `sips` tool, so on non-darwin platforms automatic normalization is unsupported and this error is thrown instead of uploading a rejected image.

Source

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

        return {
            width,
            height: Math.ceil(width / INSTAGRAM_MAX_STORY_ASPECT_RATIO),
        };
    }
    return null;
}
function buildPrivateNormalizedImagePath(filePath) {
    const parsed = path.parse(filePath);
    return path.join(os.tmpdir(), `opencli-instagram-private-${parsed.name}-${crypto.randomUUID()}${parsed.ext || '.png'}`);
}
export function prepareImageAssetForPrivateUpload(filePath) {
    const asset = readImageAsset(filePath);
    const normalizedDimensions = getInstagramFeedNormalizedDimensions(asset.width, asset.height);
    if (!normalizedDimensions) {
        return asset;
    }
    if (process.platform !== 'darwin') {
        throw new CommandExecutionError(`Instagram private publish does not support auto-normalizing ${asset.fileName} on ${process.platform}`, `Use images within ${INSTAGRAM_MIN_FEED_ASPECT_RATIO.toFixed(2)}-${INSTAGRAM_MAX_FEED_ASPECT_RATIO.toFixed(2)} aspect ratio, or use the UI route`);
    }
    const outputPath = buildPrivateNormalizedImagePath(filePath);
    const result = spawnSync('sips', [
        '--padToHeightWidth',
        String(normalizedDimensions.height),
        String(normalizedDimensions.width),
        '--padColor',
        INSTAGRAM_PRIVATE_PAD_COLOR,
        filePath,
        '--out',
        outputPath,
    ], {
        encoding: 'utf8',
    });
    if (result.error || result.status !== 0 || !fs.existsSync(outputPath)) {
        const detail = [result.error?.message, result.stderr, result.stdout]
            .map((value) => String(value || '').trim())
            .filter(Boolean)

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pre-normalize the image yourself (pad to an allowed aspect ratio) before upload
  2. Crop or letterbox the image to within the allowed feed aspect ratio
  3. Use the UI route, which handles normalization differently
  4. Run the publish from macOS where sips-based auto-normalization works

Example fix

// before
await publish({ media: 'tall-portrait.png' }); // fails on linux
// after
// $ magick tall-portrait.png -background white -gravity center -extent 1080x1350 padded.png
await publish({ media: 'padded.png' });
Defensive patterns

Strategy: validation

Validate before calling

const { width, height } = sizeOf(filePath);
const ratio = width / height;
const ok = ratio >= 0.8 && ratio <= 1.91; // within typical feed range
if (!ok && process.platform !== 'darwin') {
  throw new Error('pad the image to an allowed feed aspect ratio first');
}

Try / catch

try {
  await publish(cfg);
} catch (e) {
  if (/does not support auto-normalizing/.test(e.message)) {
    cfg.media = padToFeedRatio(cfg.media); // pre-normalize, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: prepareImageAssetForPrivateUpload computes non-null getInstagramFeedNormalizedDimensions (aspect ratio outside the allowed feed range) while process.platform !== 'darwin'.

Common situations: Publishing a portrait/square image outside the feed ratio range on Linux CI or Windows, images generated by a pipeline without pre-padding.

Related errors


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