{"record":{"id":"b38038d2660badd8","repo":"jackwener/OpenCLI","slug":"no-emptylabel-notes-found-ensure-you-are-logge","errorCode":null,"errorMessage":"No ${emptyLabel} notes found. Ensure you are logged in and this profile tab is visible.","messagePattern":"No (.+?) notes found\\. Ensure you are logged in and this profile tab is visible\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/xiaohongshu/collection-helpers.js","lineNumber":277,"sourceCode":"    for (let i = 0; notes.length < limit && i < 4; i += 1) {\n        await page.autoScroll({ times: 1, delayMs: 1500 });\n        await page.wait(1);\n        await assertOnCollectionProfile(page, userId);\n        const nextNotes = await accumulateInterceptedNotes(page, capturedRequests, userId);\n        if (nextNotes.length > previousCount) {\n            notes = nextNotes;\n            previousCount = nextNotes.length;\n            continue;\n        }\n        break;\n    }\n    if (notes.length === 0) {\n        const domNotes = await extractNotesFromDom(page);\n        if (domNotes.length > 0)\n            notes = domNotes;\n    }\n    if (notes.length === 0) {\n        throw new EmptyResultError('xiaohongshu collection', `No ${emptyLabel} notes found. Ensure you are logged in and this profile tab is visible.`);\n    }\n    return notes.slice(0, limit).map((item, index) => ({\n        rank: index + 1,\n        ...item,\n    }));\n}\n","sourceCodeStart":259,"sourceCodeEnd":284,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/collection-helpers.js#L259-L284","documentation":"fetchXhsCollectionNotes throws EmptyResultError when neither the API path nor the DOM fallback produced any notes. The library treats an empty collection as an operational problem (login state or page visibility) rather than a valid result.","triggerScenarios":"API-fetched notes array is empty AND extractNotesFromDom also returns zero rows for the requested profile tab (e.g. liked/collected notes).","commonSituations":"User session not logged in, XHS hides liked/collection tabs for privacy, wrong tab/URL passed in emptyLabel context, or anti-bot rendering blocked the grid.","solutions":["Confirm the browser context is logged into XHS and can see the collection tab manually.","Open the target profile tab URL in the page and verify notes render before running the command.","Try another profile/own account - other users' liked tabs are often hidden.","Increase wait times or scroll to trigger lazy-loaded notes before extraction."],"exampleFix":"// before\ntry { notes = await fetchXhsCollectionNotes(page, opts); }\ncatch (e) { /* EmptyResultError */ }\n// after\ntry { notes = await fetchXhsCollectionNotes(page, opts); }\ncatch (e) {\n  if (e instanceof EmptyResultError) {\n    await ensureLogin(page);\n    await page.goto(tabUrl, { waitUntil: 'networkidle' });\n    notes = await fetchXhsCollectionNotes(page, opts);\n  } else throw e;\n}","handlingStrategy":"fallback","validationCode":"const visible = await page.locator('.note-item, [class*=\"note\"]').count();\nif (visible === 0) console.warn('No notes rendered on this tab - check login/tab visibility');","typeGuard":"function looksEmptyResult(e) {\n  return e instanceof EmptyResultError || /No .* notes found/.test(String(e?.message));\n}","tryCatchPattern":"try {\n  notes = await fetchXhsCollectionNotes(page, opts);\n} catch (e) {\n  if (e instanceof EmptyResultError) {\n    console.warn('Skipping tab:', opts.tab, '-', e.message);\n    notes = [];\n  } else throw e;\n}","preventionTips":["Scrape only your own account's tabs; other users' liked tabs are often private.","Confirm the target tab is manually viewable in the same browser profile.","Scroll to trigger lazy loading before declaring the collection empty.","Treat EmptyResultError as a skip-condition, not a crash, in batch jobs."],"tags":["scraping","empty-result","auth"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}