{"record":{"id":"25e997bf276c765a","repo":"jackwener/OpenCLI","slug":"note-noteid-not-visible-in-the-tab-verify","errorCode":null,"errorMessage":"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).","messagePattern":"Note (.+?) not visible in the 已发布 tab\\. Verify the note belongs to the logged-in account and has cleared review \\(审核中 / 未通过 rows have no web delete entry\\)\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/xiaohongshu/delete-note.js","lineNumber":198,"sourceCode":"            return true;\n          }\n        }\n        return false;\n      }\n    `)), 'published-tab');\n            if (!tabClicked) {\n                throw new CommandExecutionError('xiaohongshu/delete-note: 已发布 tab not found on note-manager; xhs creator UI may have changed.');\n            }\n            await page.wait({ time: ROW_SETTLE_MS / 1000 });\n            // Step 2: locate the .note row whose data-impression JSON carries the\n            // exact `noteId` field. Dry-run stops here; execute clicks delete.\n            // Substring matching on the raw attribute would risk matching unrelated\n            // fields whose values happen to share the noteId prefix, so parse the JSON\n            // and compare `noteTarget.value.noteId` explicitly.\n            const initResult = requireActionResult(unwrapEvaluateResult(await page.evaluate(buildLocateAndMaybeDeleteScript(noteId, execute))), 'locate-note');\n            if (!initResult?.ok) {\n                if (initResult?.kind === 'not_found') {\n                    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).`);\n                }\n                if (initResult?.kind === 'no_delete_action') {\n                    throw new CommandExecutionError(`xiaohongshu/delete-note: note ${noteId} row found but no delete action visible; xhs creator UI may have changed.`);\n                }\n                throw new CommandExecutionError('xiaohongshu/delete-note: failed to locate note row');\n            }\n            if (!execute) {\n                return [{ status: 'dry-run', note_id: noteId, message: 'Target note row and delete action verified. Re-run with --execute to delete.' }];\n            }\n            await page.wait({ time: MODAL_SETTLE_MS / 1000 });\n            // Step 3: click \"确定\" in the `.d-modal-footer` confirmation modal.\n            const confirmResult = requireActionResult(unwrapEvaluateResult(await page.evaluate(`\n      () => {\n        const isVisible = (el) => !!el && el.offsetParent !== null;\n        const footer = Array.from(document.querySelectorAll('.d-modal-footer')).find(isVisible);\n        if (!footer) return { ok: false, kind: 'no_modal' };\n        const buttons = Array.from(footer.querySelectorAll('button, [role=\"button\"]')).filter(isVisible);\n        const confirmBtn = buttons.find((b) => (b.innerText || b.textContent || '').trim() === '确定');","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/delete-note.js#L180-L216","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the noteId matches exactly (24 hex chars) and that creator.xiaohongshu.com is logged into the account that owns the note","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","Confirm the note wasn't already deleted in a previous run","Re-run after waiting for the list to fully load, or scroll/paginate so the row is rendered"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the note exists and is published under the logged-in account before deleting:\nconst found = await page.evaluate(`(id) => {\n  for (const row of document.querySelectorAll('.note')) {\n    try {\n      const j = JSON.parse(row.getAttribute('data-impression') || '');\n      if (j?.noteTarget?.value?.noteId === id) return true;\n    } catch {}\n  }\n  return false;\n}`, noteId);\nif (!found) throw new Error(`note ${noteId} not visible in 已发布 tab`);","typeGuard":null,"tryCatchPattern":"try {\n  await cli('xiaohongshu', 'delete-note', { note: noteId });\n} catch (err) {\n  if (err instanceof EmptyResultError) {\n    console.error(`Note ${noteId} is not visible for web deletion — check ownership, review state (审核中/未通过), or prior deletion.`);\n  } else throw err;\n}","preventionTips":["Confirm the note ID belongs to the account logged into creator.xiaohongshu.com before deleting","Never attempt web deletion for notes under review or rejected — use the mobile app for those states","Idempotency: track already-deleted note IDs to avoid re-deleting","Allow the published list to fully load/paginate before concluding the note is absent"],"tags":["empty-result","browser-automation","ui-automation"],"backgroundTag":"target-row-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}