{"record":{"id":"a7a61f2529d9eaf0","repo":"jackwener/OpenCLI","slug":"instagram-private-publish-does-not-support-auto-no","errorCode":null,"errorMessage":"Instagram private publish does not support auto-normalizing ${asset.fileName} on ${process.platform}","messagePattern":"Instagram private publish does not support auto-normalizing (.+?) on (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/_shared/private-publish.js","lineNumber":339,"sourceCode":"        return {\n            width,\n            height: Math.ceil(width / INSTAGRAM_MAX_STORY_ASPECT_RATIO),\n        };\n    }\n    return null;\n}\nfunction buildPrivateNormalizedImagePath(filePath) {\n    const parsed = path.parse(filePath);\n    return path.join(os.tmpdir(), `opencli-instagram-private-${parsed.name}-${crypto.randomUUID()}${parsed.ext || '.png'}`);\n}\nexport function prepareImageAssetForPrivateUpload(filePath) {\n    const asset = readImageAsset(filePath);\n    const normalizedDimensions = getInstagramFeedNormalizedDimensions(asset.width, asset.height);\n    if (!normalizedDimensions) {\n        return asset;\n    }\n    if (process.platform !== 'darwin') {\n        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`);\n    }\n    const outputPath = buildPrivateNormalizedImagePath(filePath);\n    const result = spawnSync('sips', [\n        '--padToHeightWidth',\n        String(normalizedDimensions.height),\n        String(normalizedDimensions.width),\n        '--padColor',\n        INSTAGRAM_PRIVATE_PAD_COLOR,\n        filePath,\n        '--out',\n        outputPath,\n    ], {\n        encoding: 'utf8',\n    });\n    if (result.error || result.status !== 0 || !fs.existsSync(outputPath)) {\n        const detail = [result.error?.message, result.stderr, result.stdout]\n            .map((value) => String(value || '').trim())\n            .filter(Boolean)","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/_shared/private-publish.js#L321-L357","documentation":"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.","triggerScenarios":"prepareImageAssetForPrivateUpload computes non-null getInstagramFeedNormalizedDimensions (aspect ratio outside the allowed feed range) while process.platform !== 'darwin'.","commonSituations":"Publishing a portrait/square image outside the feed ratio range on Linux CI or Windows, images generated by a pipeline without pre-padding.","solutions":["Pre-normalize the image yourself (pad to an allowed aspect ratio) before upload","Crop or letterbox the image to within the allowed feed aspect ratio","Use the UI route, which handles normalization differently","Run the publish from macOS where sips-based auto-normalization works"],"exampleFix":"// before\nawait publish({ media: 'tall-portrait.png' }); // fails on linux\n// after\n// $ magick tall-portrait.png -background white -gravity center -extent 1080x1350 padded.png\nawait publish({ media: 'padded.png' });","handlingStrategy":"validation","validationCode":"const { width, height } = sizeOf(filePath);\nconst ratio = width / height;\nconst ok = ratio >= 0.8 && ratio <= 1.91; // within typical feed range\nif (!ok && process.platform !== 'darwin') {\n  throw new Error('pad the image to an allowed feed aspect ratio first');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await publish(cfg);\n} catch (e) {\n  if (/does not support auto-normalizing/.test(e.message)) {\n    cfg.media = padToFeedRatio(cfg.media); // pre-normalize, then retry\n  } else throw e;\n}","preventionTips":["Emit assets already within the feed aspect ratio range","Run private-route publishing on macOS or pre-pad images yourself","Check image dimensions in your asset pipeline before publish","Use the UI route when auto-normalization is unavailable"],"tags":["instagram","image","platform-limitation","macos"],"backgroundTag":"image-aspect-ratio-unsupported","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}