jackwener/OpenCLI · error · EmptyResultError

Note ${noteId} not visible in the 已发布 tab. Verify the note b

Error message

Note ${noteId} not visible in the 已发布 tab. Verify the note belongs to the logged-in account and has cleared review (审核中 / 未通过 rows have no web delete entry).

What it means

The locate script scanned all .note rows in the 已发布 tab and found none whose data-impression JSON contained noteTarget.value.noteId equal to the requested note ID. The CLI raises an EmptyResultError indicating the note simply isn't visible for deletion on the web — notes still in review (审核中) or rejected (未通过) have no web delete entry, and other accounts' notes won't appear.

Source

Thrown at clis/xiaohongshu/delete-note.js:198

            return true;
          }
        }
        return false;
      }
    `)), 'published-tab');
            if (!tabClicked) {
                throw new CommandExecutionError('xiaohongshu/delete-note: 已发布 tab not found on note-manager; xhs creator UI may have changed.');
            }
            await page.wait({ time: ROW_SETTLE_MS / 1000 });
            // Step 2: locate the .note row whose data-impression JSON carries the
            // exact `noteId` field. Dry-run stops here; execute clicks delete.
            // Substring matching on the raw attribute would risk matching unrelated
            // fields whose values happen to share the noteId prefix, so parse the JSON
            // and compare `noteTarget.value.noteId` explicitly.
            const initResult = requireActionResult(unwrapEvaluateResult(await page.evaluate(buildLocateAndMaybeDeleteScript(noteId, execute))), 'locate-note');
            if (!initResult?.ok) {
                if (initResult?.kind === 'not_found') {
                    throw new EmptyResultError('xiaohongshu/delete-note', `Note ${noteId} not visible in the 已发布 tab. Verify the note belongs to the logged-in account and has cleared review (审核中 / 未通过 rows have no web delete entry).`);
                }
                if (initResult?.kind === 'no_delete_action') {
                    throw new CommandExecutionError(`xiaohongshu/delete-note: note ${noteId} row found but no delete action visible; xhs creator UI may have changed.`);
                }
                throw new CommandExecutionError('xiaohongshu/delete-note: failed to locate note row');
            }
            if (!execute) {
                return [{ status: 'dry-run', note_id: noteId, message: 'Target note row and delete action verified. Re-run with --execute to delete.' }];
            }
            await page.wait({ time: MODAL_SETTLE_MS / 1000 });
            // Step 3: click "确定" in the `.d-modal-footer` confirmation modal.
            const confirmResult = requireActionResult(unwrapEvaluateResult(await page.evaluate(`
      () => {
        const isVisible = (el) => !!el && el.offsetParent !== null;
        const footer = Array.from(document.querySelectorAll('.d-modal-footer')).find(isVisible);
        if (!footer) return { ok: false, kind: 'no_modal' };
        const buttons = Array.from(footer.querySelectorAll('button, [role="button"]')).filter(isVisible);
        const confirmBtn = buttons.find((b) => (b.innerText || b.textContent || '').trim() === '确定');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm the noteId matches exactly (24 hex chars) and that creator.xiaohongshu.com is logged into the account that owns the note
  2. Check in the browser that the note appears under 已发布 (published); 审核中/未通过 notes cannot be deleted via the web and must be removed in the mobile app
  3. Confirm the note wasn't already deleted in a previous run
  4. Re-run after waiting for the list to fully load, or scroll/paginate so the row is rendered
Defensive patterns

Strategy: validation

Validate before calling

// Verify the note exists and is published under the logged-in account before deleting:
const found = await page.evaluate(`(id) => {
  for (const row of document.querySelectorAll('.note')) {
    try {
      const j = JSON.parse(row.getAttribute('data-impression') || '');
      if (j?.noteTarget?.value?.noteId === id) return true;
    } catch {}
  }
  return false;
}`, noteId);
if (!found) throw new Error(`note ${noteId} not visible in 已发布 tab`);

Try / catch

try {
  await cli('xiaohongshu', 'delete-note', { note: noteId });
} catch (err) {
  if (err instanceof EmptyResultError) {
    console.error(`Note ${noteId} is not visible for web deletion — check ownership, review state (审核中/未通过), or prior deletion.`);
  } else throw err;
}

Prevention

When it happens

Trigger: The noteId was mistyped (or the URL regex grabbed a different ID than intended); the note belongs to a different logged-in account; the note is still under review (审核中), was rejected (未通过), or is a draft; the note was already deleted; the row hasn't loaded within the settle window.

Common situations: Copying the note ID from a message while logged into the wrong XHS account; trying to delete a note that is pending moderation (web UI offers no delete for those); deleting the same note twice in a row; the Published tab paginated and the row not yet rendered.

Related errors


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