{"record":{"id":"50cd3346fd9943a4","repo":"jackwener/OpenCLI","slug":"instagram-caption-editor-did-not-appear","errorCode":null,"errorMessage":"Instagram caption editor did not appear","messagePattern":"Instagram caption editor did not appear","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/post.js","lineNumber":963,"sourceCode":"                    throw makeUploadFailure(uploadState.detail);\n                }\n                if (attempt < 2) {\n                    continue;\n                }\n            }\n            throw error;\n        }\n        await page.wait({ time: 1.5 });\n        if (await hasCaptionEditor(page)) {\n            return;\n        }\n        const uploadState = await inspectUploadStage(page);\n        if (uploadState.state === 'failed') {\n            throw makeUploadFailure(uploadState.detail);\n        }\n    }\n    await page.screenshot({ path: '/tmp/instagram_post_caption_debug.png' });\n    throw new CommandExecutionError('Instagram caption editor did not appear', 'Instagram may have changed the publish flow; inspect /tmp/instagram_post_caption_debug.png');\n}\nasync function waitForCaptionEditor(page) {\n    if (!(await hasCaptionEditor(page))) {\n        await page.screenshot({ path: '/tmp/instagram_post_caption_debug.png' });\n        throw new CommandExecutionError('Instagram caption editor did not appear', 'Instagram may have changed the publish flow; inspect /tmp/instagram_post_caption_debug.png');\n    }\n}\nasync function rethrowUploadFailureIfPresent(page, originalError) {\n    const uploadState = await inspectUploadStage(page);\n    if (uploadState.state === 'failed') {\n        throw makeUploadFailure(uploadState.detail);\n    }\n    throw originalError;\n}\nasync function focusCaptionEditorForNativeInsert(page) {\n    const result = await page.evaluate(`\n    (() => {\n      const textarea = document.querySelector('[aria-label=\"Write a caption...\"], textarea');","sourceCodeStart":945,"sourceCodeEnd":981,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/post.js#L945-L981","documentation":"This variant of the caption-editor error is thrown after the click-to-advance step: if the upload stage later reports 'failed', the library rethrows an upload failure, otherwise it captures /tmp/instagram_post_caption_debug.png and throws because the caption editor never appeared. It means the publish flow did not reach the caption step.","triggerScenarios":"executeUiInstagramPost advances the composer, re-checks inspectUploadStage (rethrowing makeUploadFailure on state 'failed'), and on still no caption editor takes a debug screenshot and throws this error.","commonSituations":"Instagram changed the publish flow (new intermediate dialog), the Next click landed on a dialog the script doesn't understand, upload silently failed, or an account-level popup interrupting navigation.","solutions":["Inspect /tmp/instagram_post_caption_debug.png to see the actual screen after advancing","Handle any intermediate dialogs (save-password, contacts-sync) before posting","Update the CLI to match a changed Instagram publish flow","Retry; intermittent A/B UI variants may succeed on a second run"],"exampleFix":"// before\nawait postImage(page, 'photo.jpg');\n// after\nawait dismissLoginInfoDialog(page); // close the 'Save your login info?' modal first\nawait postImage(page, 'photo.jpg');","handlingStrategy":"try-catch","validationCode":"await dismissKnownDialogs(page); // close 'save login info', 'contacts sync' prompts before advancing","typeGuard":null,"tryCatchPattern":"try {\n  await advanceToCaptionEditor(page);\n} catch (e) {\n  if (String(e.message).includes('caption editor did not appear')) {\n    // inspect /tmp/instagram_post_caption_debug.png\n    await dismissKnownDialogs(page);\n    await advanceToCaptionEditor(page);\n  } else throw e;\n}","preventionTips":["Programmatically dismiss known Instagram dialogs before each post","Keep the CLI updated for Instagram publish-flow changes","Archive debug screenshots to spot recurring flow changes"],"tags":["instagram","ui-automation","timeout"],"backgroundTag":"ui-state-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}