jackwener/OpenCLI · warning · EmptyResultError

Note ${noteId} not found or unavailable — it may have been d

Error message

Note ${noteId} not found or unavailable — it may have been deleted or restricted

What it means

The extraction script flagged data.notFound: the requested note could not be loaded — typically because it was deleted, set to private, restricted by the author or platform, or the link is invalid. EmptyResultError('xiaohongshu/note', ...) communicates that there is simply no note content to return.

Source

Thrown at clis/xiaohongshu/note.js:95

        const raw = String(kwargs['note-id']);
        const noteId = parseNoteId(raw);
        const url = buildNoteUrl(raw, { commandName: 'xiaohongshu note' });
        await page.goto(url);
        await page.wait({ time: 2 + Math.random() * 3 });
        const data = await page.evaluate(NOTE_EXTRACT_JS);
        if (!data || typeof data !== 'object') {
            throw new EmptyResultError('xiaohongshu/note', 'Unexpected evaluate response');
        }
        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 || '') },
        ];

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm the note still exists by opening the URL manually in the browser.
  2. Check with the author whether the note was deleted or restricted.
  3. Use a fresh signed URL from search results in case the old link is stale.
  4. Handle EmptyResultError gracefully in your automation — deleted notes are normal over time.

Example fix

// before
const note = await getNote(staleUrl); // note deleted
// after
try {
  const note = await getNote(freshSignedUrl);
} catch (e) {
  if (isCliError(e, 'EMPTY_RESULT')) return null; // treat as deleted/missing
  throw e;
}
Defensive patterns

Strategy: fallback

Validate before calling

// Can't pre-validate existence; validate the ID format at least
if (!/^[a-f0-9]{16,32}$/i.test(noteId)) console.warn('suspicious note id format:', noteId);

Type guard

function isNotFoundError(err) {
  return err instanceof EmptyResultError && /not found or unavailable/.test(err.message);
}

Try / catch

try {
  return await note(url);
} catch (err) {
  if (isNotFoundError(err)) return null; // deleted/private/removed — not a transient failure
  throw err;
}

Prevention

When it happens

Trigger: page.evaluate(NOTE_EXTRACT_JS) returns { notFound: true } — the note detail page rendered a 'content not found'/404-style state for the given noteId/URL.

Common situations: The author deleted the note; the note was made private or friends-only; the note was removed by moderation; using an old saved URL whose note no longer exists; typo in the note ID.

Related errors


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