jackwener/OpenCLI · warning · EmptyResultError

The note page loaded without visible content. The note may b

Error message

The note page loaded without visible content. The note may be deleted or restricted.

What it means

EmptyResultError thrown by the xiaohongshu note CLI when the scraped note page has neither a title nor an author. Since every real XHS note page renders an author, both being empty means the page never actually loaded its content (deleted note, restricted/hidden note, login wall, or anti-bot interstitial). The library throws to prevent emitting a misleading empty result.

Source

Thrown at clis/xiaohongshu/note.js:104

        if (data.securityBlock) {
            throw new CliError('SECURITY_BLOCK', 'Xiaohongshu security block: the note detail page was blocked by risk control.', /^https?:\/\//.test(raw)
                ? 'The page may be temporarily restricted. Try again later or from a different session.'
                : 'Try using a full URL from search results (with xsec_token) instead of a bare note ID.');
        }
        if (data.loginWall) {
            throw new AuthRequiredError('www.xiaohongshu.com', 'Note content requires login');
        }
        if (data.notFound) {
            throw new EmptyResultError('xiaohongshu/note', `Note ${noteId} not found or unavailable — it may have been deleted or restricted`);
        }
        const d = data;
        // XHS renders placeholder text like "赞"/"收藏"/"评论" when count is 0;
        // normalize to '0' unless the value looks numeric.
        const numOrZero = (v) => /^\d+/.test(v) ? v : '0';
        // A note may legitimately have no title, but a real note page always
        // renders an author. If both are missing, the page failed to load.
        if (!d.title && !d.author) {
            throw new EmptyResultError('xiaohongshu/note', 'The note page loaded without visible content. The note may be deleted or restricted.');
        }
        const rows = [
            { field: 'title', value: d.title || '' },
            { field: 'author', value: d.author || '' },
            { field: 'content', value: d.desc || '' },
            { field: 'likes', value: numOrZero(d.likes || '') },
            { field: 'collects', value: numOrZero(d.collects || '') },
            { field: 'comments', value: numOrZero(d.comments || '') },
        ];
        if (d.tags?.length) {
            rows.push({ field: 'tags', value: d.tags.join(', ') });
        }
        return rows;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the note URL opens and shows content in a normal browser (ideally logged in).
  2. Provide valid login cookies/session for the xiaohongshu CLI session.
  3. Retry later or from a different IP if XHS risk control is serving a blank page.
  4. Treat the note as unavailable and handle the EmptyResultError in your workflow.

Example fix

// before
const note = await xhs.note('https://xhslink.com/abc'); // throws if note deleted
// after
try {
  const note = await xhs.note(url);
} catch (err) {
  if (err.name === 'EmptyResultError') skipNote(url); // note deleted/restricted
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check URL reachability/content in your own scraper if possible;
// otherwise nothing to validate client-side beyond the URL format
if (!/^https?:\/\/(www\.)?xiaohongshu\.com\//.test(url)) throw new Error('bad note url');

Type guard

function looksLikeValidNoteData(d) {
  return typeof d === 'object' && d !== null &&
    (typeof d.title === 'string' && d.title.length > 0 ||
     typeof d.author === 'string' && d.author.length > 0);
}

Try / catch

try {
  const note = await xhs.note(url);
} catch (err) {
  if (err.name === 'EmptyResultError') {
    markNoteUnavailable(url); // deleted/restricted
  } else throw err;
}

Prevention

When it happens

Trigger: Calling the note command with a URL/id of a deleted or privacy-restricted note; XHS serving a login wall or verification page; the page rendering an error state instead of note content so d.title and d.author are both empty after extraction.

Common situations: Sharing links that were later deleted; notes limited to followers or removed by moderation; scraping without a logged-in cookie so XHS redirects to a login/verify page; IP flagged by XHS risk control returning a blank shell page.

Related errors


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