{"record":{"id":"f17aa01b028aca0b","repo":"jackwener/OpenCLI","slug":"rawresult-error-rawresult-hint-rawresult","errorCode":null,"errorMessage":"rawResult.error + (rawResult.hint ? ` (${rawResult.hint})` : '')","messagePattern":"rawResult\\.error \\+ \\(rawResult\\.hint \\? ` \\((.+?)\\)` : ''\\)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/twitter/article.js","lineNumber":256,"sourceCode":"          title,\n          author: screenName,\n          content: parts.join('\\\\n\\\\n') || legacy.full_text || '',\n          url: 'https://x.com/' + screenName + '/status/' + tweetId,\n        }];\n      }\n    `));\n        if (!Array.isArray(rawResult) && !isPlainObject(rawResult)) {\n            throw new CommandExecutionError('Twitter article response payload is malformed');\n        }\n        if (rawResult?.httpStatus) {\n            const message = describeTwitterApiError('TweetResultByRestId', rawResult.httpStatus);\n            if (rawResult.httpStatus === 401 || rawResult.httpStatus === 403) {\n                throw new AuthRequiredError('x.com', message);\n            }\n            throw new CommandExecutionError(message);\n        }\n        if (rawResult?.error) {\n            throw new CommandExecutionError(rawResult.error + (rawResult.hint ? ` (${rawResult.hint})` : ''));\n        }\n        if (!Array.isArray(rawResult)) {\n            throw new CommandExecutionError('Twitter article response payload is malformed');\n        }\n        return rawResult;\n    }\n});\n","sourceCodeStart":238,"sourceCodeEnd":264,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/twitter/article.js#L238-L264","documentation":"Thrown when the in-page article probe returns an envelope with an explicit error field (and optionally a hint). The CLI surfaces error + hint verbatim as a CommandExecutionError. It indicates the page script detected a failure (e.g. not logged in, element missing) and reported it through the result object instead of an HTTP status.","triggerScenarios":"The browser-side script returned { error: ..., hint?: ... } from the page.evaluate result — e.g. article DOM not found, user not authenticated, or tweet body unavailable.","commonSituations":"Expired or missing x.com session cookies, viewing a protected account's tweet while not following, or Twitter DOM changes that break the article extractor selectors.","solutions":["Read the error/hint text in the message — it states the concrete cause.","Re-authenticate with x.com via the CLI's auth/login command if the hint mentions login or cookies.","Retry with a logged-in browser session and confirm the tweet opens normally in the browser.","Update the CLI if Twitter changed its DOM; a stale extractor can report errors."],"exampleFix":"// before\nconst rows = await cli.run('twitter article <url>');\n// after\ntry {\n  const rows = await cli.run('twitter article <url>');\n} catch (e) {\n  if (/logged in|cookies/i.test(e.message)) await cli.run('auth login x.com');\n  else throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (!browserSessionActive()) await startBrowserAndLogin('x.com');","typeGuard":"function isApiErrorEnvelope(r) {\n  return r !== null && typeof r === 'object' && typeof r.error === 'string';\n}","tryCatchPattern":"try {\n  const rows = await cli.run('twitter article <url>');\n} catch (e) {\n  if (/logged in|cookies|auth/i.test(e.message)) await cli.run('auth login x.com');\n  else throw e;\n}","preventionTips":["Log in to x.com before article fetches","Read the error+hint in the message — it names the concrete cause","Keep CLI and Browser Bridge extension versions in sync","Retry once after re-login before escalating"],"tags":["twitter-api","in-page-error","authentication"],"backgroundTag":"api-error-envelope","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}