{"record":{"id":"7b70154277d439f4","repo":"jackwener/OpenCLI","slug":"uierror-message","errorCode":null,"errorMessage":"${uiError.message}","messagePattern":"\\$\\{uiError\\.message\\}","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/post.js","lineNumber":1465,"sourceCode":"                        content,\n                        existingPostPaths,\n                        commandAttemptBudget,\n                        preUploadDelaySeconds,\n                        uploadAttemptBudget,\n                        previewProbeWindowSeconds,\n                        finalPreviewWaitSeconds,\n                        preShareDelaySeconds,\n                        inlineUploadRetryBudget,\n                        installProtocolCapture,\n                        drainProtocolCapture,\n                        forceFreshStart: true,\n                    });\n                }\n                catch (uiError) {\n                    if (uiError instanceof AuthRequiredError)\n                        throw uiError;\n                    if (uiError instanceof CommandExecutionError) {\n                        throw new CommandExecutionError(uiError.message, buildFallbackHint(error, uiError));\n                    }\n                    throw uiError;\n                }\n            }\n        }\n        finally {\n            if (protocolCaptureEnabled) {\n                try {\n                    await drainProtocolCapture();\n                }\n                catch {\n                    // Best-effort: capture export should not hide the main command result.\n                }\n                fs.writeFileSync(INSTAGRAM_PROTOCOL_TRACE_OUTPUT_PATH, JSON.stringify({\n                    data: protocolCaptureData,\n                    errors: protocolCaptureErrors,\n                }, null, 2));\n            }","sourceCodeStart":1447,"sourceCodeEnd":1483,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/post.js#L1447-L1483","documentation":"In post.js's private-route → UI fallback chain, when the UI-based share path (executeUiInstagramPost) throws a CommandExecutionError, it is re-thrown with a new hint built by buildFallbackHint(error, uiError), which combines why the private API path failed and why the UI path failed. The message is the original uiError message; only the remediation hint is enriched.","triggerScenarios":"Both share strategies failed: the private API route failed with a recoverable (isSafePrivateRouteFallbackError) error, then the UI route also threw a CommandExecutionError (e.g. 2020/2021 above).","commonSituations":"Instagram API + UI simultaneously degraded; account rate-limited so both paths fail; stale session cookies breaking private route while a UI dialog blocks the UI route.","solutions":["Read the combined hint (buildFallbackHint output) — it names both the private-route failure and the UI-route failure","Fix the root cause reported for the first (private API) failure; the UI error is often a downstream symptom","Re-authenticate / refresh the Instagram session, then retry the post command","If both hints point to rate limiting, back off (minutes to hours) before retrying"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isCommandExecutionError(e) {\n  return e instanceof CommandExecutionError;\n}","tryCatchPattern":"try {\n  await postToInstagram(media, caption);\n} catch (e) {\n  if (e instanceof CommandExecutionError) {\n    // the hint now describes BOTH the private-route and UI-route failures — surface it verbatim\n    console.error('Post failed:', e.message, '\\nHint:', e.hint);\n    process.exitCode = 1;\n  } else throw e;\n}","preventionTips":["Refresh the Instagram session before long automation runs so both routes share valid cookies","Back off on rate limits early — by the time both routes fail, the account is usually throttled","Set OPENCLI_INSTAGRAM_CAPTURE=1 during debugging to see the underlying protocol errors","Read the combined fallback hint before retrying; it usually names the shared root cause"],"tags":["instagram","fallback","command-execution-error","automation"],"backgroundTag":"fallback-path-exhausted","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}