{"record":{"id":"f8ae88395281d382","repo":"jackwener/OpenCLI","slug":"note-noteid-not-found-or-unavailable-it-may-h","errorCode":null,"errorMessage":"Note ${noteId} not found or unavailable — it may have been deleted or restricted","messagePattern":"Note (.+?) not found or unavailable — it may have been deleted or restricted","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/xiaohongshu/note.js","lineNumber":95,"sourceCode":"        const raw = String(kwargs['note-id']);\n        const noteId = parseNoteId(raw);\n        const url = buildNoteUrl(raw, { commandName: 'xiaohongshu note' });\n        await page.goto(url);\n        await page.wait({ time: 2 + Math.random() * 3 });\n        const data = await page.evaluate(NOTE_EXTRACT_JS);\n        if (!data || typeof data !== 'object') {\n            throw new EmptyResultError('xiaohongshu/note', 'Unexpected evaluate response');\n        }\n        if (data.securityBlock) {\n            throw new CliError('SECURITY_BLOCK', 'Xiaohongshu security block: the note detail page was blocked by risk control.', /^https?:\\/\\//.test(raw)\n                ? 'The page may be temporarily restricted. Try again later or from a different session.'\n                : 'Try using a full URL from search results (with xsec_token) instead of a bare note ID.');\n        }\n        if (data.loginWall) {\n            throw new AuthRequiredError('www.xiaohongshu.com', 'Note content requires login');\n        }\n        if (data.notFound) {\n            throw new EmptyResultError('xiaohongshu/note', `Note ${noteId} not found or unavailable — it may have been deleted or restricted`);\n        }\n        const d = data;\n        // XHS renders placeholder text like \"赞\"/\"收藏\"/\"评论\" when count is 0;\n        // normalize to '0' unless the value looks numeric.\n        const numOrZero = (v) => /^\\d+/.test(v) ? v : '0';\n        // A note may legitimately have no title, but a real note page always\n        // renders an author. If both are missing, the page failed to load.\n        if (!d.title && !d.author) {\n            throw new EmptyResultError('xiaohongshu/note', 'The note page loaded without visible content. The note may be deleted or restricted.');\n        }\n        const rows = [\n            { field: 'title', value: d.title || '' },\n            { field: 'author', value: d.author || '' },\n            { field: 'content', value: d.desc || '' },\n            { field: 'likes', value: numOrZero(d.likes || '') },\n            { field: 'collects', value: numOrZero(d.collects || '') },\n            { field: 'comments', value: numOrZero(d.comments || '') },\n        ];","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/note.js#L77-L113","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the note still exists by opening the URL manually in the browser.","Check with the author whether the note was deleted or restricted.","Use a fresh signed URL from search results in case the old link is stale.","Handle EmptyResultError gracefully in your automation — deleted notes are normal over time."],"exampleFix":"// before\nconst note = await getNote(staleUrl); // note deleted\n// after\ntry {\n  const note = await getNote(freshSignedUrl);\n} catch (e) {\n  if (isCliError(e, 'EMPTY_RESULT')) return null; // treat as deleted/missing\n  throw e;\n}","handlingStrategy":"fallback","validationCode":"// Can't pre-validate existence; validate the ID format at least\nif (!/^[a-f0-9]{16,32}$/i.test(noteId)) console.warn('suspicious note id format:', noteId);","typeGuard":"function isNotFoundError(err) {\n  return err instanceof EmptyResultError && /not found or unavailable/.test(err.message);\n}","tryCatchPattern":"try {\n  return await note(url);\n} catch (err) {\n  if (isNotFoundError(err)) return null; // deleted/private/removed — not a transient failure\n  throw err;\n}","preventionTips":["Treat 'not found' as a permanent condition — do not retry.","Verify the note still opens in a browser before adding it to automation lists.","Refresh stored note URLs from search results periodically.","Prune deleted/restricted notes from tracked datasets when this error surfaces."],"tags":["xiaohongshu","empty-result","not-found"],"backgroundTag":"content-not-found-removed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}