{"record":{"id":"f294a8a09322192d","repo":"jackwener/OpenCLI","slug":"instagram-private-publish-configure-sidecar-failed-f294a8","errorCode":null,"errorMessage":"Instagram private publish configure_sidecar failed","messagePattern":"Instagram private publish configure_sidecar failed","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/_shared/private-publish.js","lineNumber":870,"sourceCode":"        }\n        catch {\n            throw new CommandExecutionError('Instagram private publish configure_sidecar returned invalid JSON');\n        }\n        if (!response.ok) {\n            const detail = text ? ` ${text.slice(0, 500)}` : '';\n            throw new CommandExecutionError(`Instagram private publish configure_sidecar failed: ${response.status}${detail}`);\n        }\n        const message = String(json?.message || '');\n        if (response.status === 202\n            || /transcode not finished yet/i.test(message)) {\n            if (attempt >= INSTAGRAM_PRIVATE_SIDECAR_TRANSCODE_ATTEMPTS - 1) {\n                throw new CommandExecutionError('Instagram private publish configure_sidecar timed out waiting for video transcode', text.slice(0, 500));\n            }\n            await waitMs(INSTAGRAM_PRIVATE_SIDECAR_TRANSCODE_WAIT_MS);\n            continue;\n        }\n        if (String(json?.status || '').toLowerCase() === 'fail') {\n            throw new CommandExecutionError('Instagram private publish configure_sidecar failed', message || text.slice(0, 500));\n        }\n        return { code: json?.media?.code };\n    }\n    throw new CommandExecutionError('Instagram private publish configure_sidecar failed');\n}\nexport async function publishMediaViaPrivateApi(input) {\n    const now = input.now ?? (() => Date.now());\n    const clientSidecarId = String(now());\n    const uploadIds = input.mediaItems.length > 1\n        ? input.mediaItems.map((_, index) => String(now() + index + 1))\n        : [String(now())];\n    const fetcher = input.fetcher ?? ((url, init) => instagramPrivateApiFetch(input.page, url, init));\n    const prepareMediaAsset = input.prepareMediaAsset ?? prepareInstagramMediaAsset;\n    const assets = await Promise.all(input.mediaItems.map((item) => prepareMediaAsset(item)));\n    try {\n        for (let index = 0; index < assets.length; index += 1) {\n            const asset = assets[index];\n            const uploadId = uploadIds[index];","sourceCodeStart":852,"sourceCodeEnd":888,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/_shared/private-publish.js#L852-L888","documentation":"Inside the retry loop, if Instagram's configure_sidecar JSON body has status:'fail', the library throws this error with the server's message (or first 500 chars of the body) as detail. This is Instagram explicitly reporting the sidecar configure failed for a content/policy/API reason, as opposed to an HTTP-level failure.","triggerScenarios":"A configure_sidecar response with a 2xx status whose JSON has status === 'fail' (case-insensitive); thrown with json.message or the body excerpt as the CommandExecutionError detail.","commonSituations":"Media policy violation flagged at configure time; an upload id invalid or expired at configure time; caption or media combination rejected; account restrictions (action block, shadowban).","solutions":["Read the detail string attached to the error — it contains Instagram's own failure message.","Verify all upload ids in the sidecar payload correspond to successfully completed uploads.","Test with a single image publish to rule out account-level action blocks.","Reduce media count / change caption to rule out content policy triggers.","Wait before retrying — Instagram action blocks are often temporary."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check content basics before publish\nif (caption.length > 2200) throw new Error('Caption too long — configure_sidecar would fail');","typeGuard":"function isSidecarSuccess(json) {\n  return typeof json === 'object' && json !== null && json.status !== 'fail' && typeof json.media?.code === 'string';\n}","tryCatchPattern":"try {\n  await publishMediaViaPrivateApi({ mediaItems, apiContext });\n} catch (e) {\n  if (/configure_sidecar failed$/.test(e.message)) {\n    console.error('Instagram said:', e.detail ?? e.message); // server's failure reason\n  }\n  throw e;\n}","preventionTips":["Read the attached detail — it contains Instagram's own failure message.","Test with a benign single-image post to detect account-level action blocks.","Avoid flagged content/captions; review community-guideline risks.","Space out publishes to avoid action blocks."],"tags":["instagram","api-error","sidecar","content-policy"],"backgroundTag":"api-status-fail","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}