jackwener/OpenCLI · error · CommandExecutionError

rednote notifications: ${data.error}${data.detail ? ' (' + d

Error message

rednote notifications: ${data.error}${data.detail ? ' (' + data.detail + ')' : ''}

What it means

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.

Source

Thrown at clis/rednote/notifications.js:133

            name: 'type',
            default: 'mentions',
            help: 'Notification type: mentions, likes, or connections',
        },
        { name: 'limit', type: 'int', default: 20, help: 'Number of notifications to return' },
    ],
    columns: ['rank', 'user', 'action', 'content', 'note', 'time'],
    func: async (page, kwargs) => {
        const type = parseNotificationType(kwargs.type);
        const limit = parseLimit(kwargs.limit);
        await page.goto('https://www.rednote.com/notification');
        await page.wait({ time: 2 });
        const script = READ_NOTIFICATIONS_JS.replace(JSON.stringify('PLACEHOLDER_TYPE'), JSON.stringify(type));
        const data = await page.evaluate(script);
        if (!data || typeof data !== 'object') {
            throw new CommandExecutionError('rednote notifications: unexpected evaluate response');
        }
        if (data.error) {
            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.');
        }
        return (data.items || [])
            .slice(0, limit)
            .map((row, i) => ({ rank: i + 1, ...row }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Reload www.rednote.com/notification and retry the command as the error hint suggests
  2. Add a longer wait (page.wait({ time: N }) or wait for a stable DOM node) before evaluate
  3. Retry with exponential backoff a few times before surfacing the error
  4. Re-verify the extraction selectors if the site markup changed

Example fix

// before
await page.goto('https://www.rednote.com/notification');
await page.wait({ time: 2 });
// after
await page.goto('https://www.rednote.com/notification');
await page.wait({ time: 2 });
for (let i = 0; i < 3; i++) {
  const d = await page.evaluate(script);
  if (d && typeof d === 'object' && !d.error) return d;
  await page.reload(); await page.wait({ time: 2 * (i + 1) });
}
Defensive patterns

Strategy: retry

Validate before calling

const probe = await page.evaluate(script); if (probe && probe.error) console.warn('page reported:', probe.error, probe.detail);

Type guard

const hasPageError = (d) => d && typeof d === 'object' && typeof d.error === 'string';

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/4526a1caaa467cf9. Report an issue: GitHub.