{"record":{"id":"4526a1caaa467cf9","repo":"jackwener/OpenCLI","slug":"rednote-notifications-data-error-data-detail","errorCode":null,"errorMessage":"rednote notifications: ${data.error}${data.detail ? ' (' + data.detail + ')' : ''}","messagePattern":"rednote notifications: (.+?)(.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/rednote/notifications.js","lineNumber":133,"sourceCode":"            name: 'type',\n            default: 'mentions',\n            help: 'Notification type: mentions, likes, or connections',\n        },\n        { name: 'limit', type: 'int', default: 20, help: 'Number of notifications to return' },\n    ],\n    columns: ['rank', 'user', 'action', 'content', 'note', 'time'],\n    func: async (page, kwargs) => {\n        const type = parseNotificationType(kwargs.type);\n        const limit = parseLimit(kwargs.limit);\n        await page.goto('https://www.rednote.com/notification');\n        await page.wait({ time: 2 });\n        const script = READ_NOTIFICATIONS_JS.replace(JSON.stringify('PLACEHOLDER_TYPE'), JSON.stringify(type));\n        const data = await page.evaluate(script);\n        if (!data || typeof data !== 'object') {\n            throw new CommandExecutionError('rednote notifications: unexpected evaluate response');\n        }\n        if (data.error) {\n            throw new CommandExecutionError(`rednote notifications: ${data.error}${data.detail ? ' (' + data.detail + ')' : ''}`, 'The rednote SPA may still be hydrating; reload www.rednote.com/notification and retry.');\n        }\n        return (data.items || [])\n            .slice(0, limit)\n            .map((row, i) => ({ rank: i + 1, ...row }));\n    },\n});\n","sourceCodeStart":115,"sourceCodeEnd":140,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/rednote/notifications.js#L115-L140","documentation":"The in-page extraction script reported a structured failure via { error, detail }, which the command rethrows as a CommandExecutionError with a remediation hint: the rednote SPA may still be hydrating, so reload www.rednote.com/notification and retry. This is the expected failure channel when the page's own DOM/state does not match what the script needs.","triggerScenarios":"Evaluating READ_NOTIFICATIONS_JS while the notification SPA has not finished hydrating, DOM structure changed on the site, or the page surfaced an internal error object the script captured.","commonSituations":"Running the command immediately after page.goto on a slow connection, first-run sessions without cookies triggering a soft login wall, or a rednote frontend deploy changing selectors.","solutions":["Reload www.rednote.com/notification and retry the command as the error hint suggests","Add a longer wait (page.wait({ time: N }) or wait for a stable DOM node) before evaluate","Retry with exponential backoff a few times before surfacing the error","Re-verify the extraction selectors if the site markup changed"],"exampleFix":"// before\nawait page.goto('https://www.rednote.com/notification');\nawait page.wait({ time: 2 });\n// after\nawait page.goto('https://www.rednote.com/notification');\nawait page.wait({ time: 2 });\nfor (let i = 0; i < 3; i++) {\n  const d = await page.evaluate(script);\n  if (d && typeof d === 'object' && !d.error) return d;\n  await page.reload(); await page.wait({ time: 2 * (i + 1) });\n}","handlingStrategy":"retry","validationCode":"const probe = await page.evaluate(script); if (probe && probe.error) console.warn('page reported:', probe.error, probe.detail);","typeGuard":"const hasPageError = (d) => d && typeof d === 'object' && typeof d.error === 'string';","tryCatchPattern":"try { return await fetchNotifications(page, type, limit); } catch (e) { if (e instanceof CommandExecutionError && /hydrating/.test(e.hint || e.message)) { await page.reload('https://www.rednote.com/notification'); await page.wait({ time: 4 }); return fetchNotifications(page, type, limit); } throw e; }","preventionTips":["Increase the post-goto wait on slow connections","Implement bounded retry with backoff around SPA extraction commands","Authenticate the session first to avoid soft login walls presenting as hydration errors"],"tags":["browser-automation","spa","hydration","retry"],"backgroundTag":"spa-hydration-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}