{"record":{"id":"b252c48914683d76","repo":"jackwener/OpenCLI","slug":"no-posts-found-for-keyword","errorCode":null,"errorMessage":"No posts found for \"${keyword}\"","messagePattern":"No posts found for \"(.+?)\"","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/jike/search.js","lineNumber":56,"sourceCode":"\nasync function searchPosts(page, keyword, limit) {\n    const rows = [];\n    const seenIds = new Set();\n    const seenCursors = new Set();\n    let loadMoreKey = null;\n    for (let pageIndex = 0; pageIndex < MAX_PAGES; pageIndex++) {\n        const body = await fetchSearchPage(page, keyword, loadMoreKey);\n        for (const item of body.data) {\n            if (item?.type !== 'ORIGINAL_POST') continue;\n            const row = mapPost(item);\n            if (seenIds.has(row.id)) continue;\n            seenIds.add(row.id);\n            rows.push(row);\n            if (rows.length >= limit) return rows;\n        }\n        const next = body.loadMoreKey;\n        if (next == null) {\n            if (rows.length === 0) throw new EmptyResultError('jike search', `No posts found for \"${keyword}\"`);\n            return rows;\n        }\n        if (typeof next !== 'object' || Array.isArray(next)) {\n            throw new CommandExecutionError('Jike search API returned a malformed pagination cursor');\n        }\n        const cursorKey = JSON.stringify(next);\n        if (seenCursors.has(cursorKey)) {\n            throw new CommandExecutionError('Jike search pagination returned a repeated cursor');\n        }\n        seenCursors.add(cursorKey);\n        loadMoreKey = next;\n    }\n    throw new CommandExecutionError(`Jike search pagination exceeded ${MAX_PAGES} pages before satisfying --limit`);\n}\n\ncli({\n    site: 'jike',\n    name: 'search',","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jike/search.js#L38-L74","documentation":"searchPosts pages through the Jike search API until it collects --limit rows. When the response contains no loadMoreKey (pagination exhausted) and zero rows were collected, it throws EmptyResultError signalling that the keyword genuinely matched nothing. This is an expected, non-exceptional outcome surfaced as a distinct error type so callers can distinguish it from failures.","triggerScenarios":"The keyword search returns a successful body with an empty or no ORIGINAL_POST items across the first page, and body.loadMoreKey is null/undefined so no further pages can be fetched.","commonSituations":"Typo or overly specific query; searching rare/obsolete keywords; querying while logged out so results are filtered to zero; region/account restrictions hiding results.","solutions":["Verify the keyword with a different, broader query to confirm search works at all.","Check you are logged into Jike in the browser session (requireJikeIdentity passed but content may still be restricted).","Catch EmptyResultError explicitly and treat it as 'no results', not a crash."],"exampleFix":"// before\nconst rows = await runCli(['jike', 'search', keyword]);\n// after\ntry {\n  const rows = await runCli(['jike', 'search', keyword]);\n} catch (e) {\n  if (e.name === 'EmptyResultError') return [];\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// check keyword plausibility before invoking\nif (!keyword.trim()) throw new Error('provide a non-empty search keyword');","typeGuard":null,"tryCatchPattern":"try {\n  return await runCli(['jike', 'search', keyword]);\n} catch (e) {\n  if (e.name === 'EmptyResultError') return [];\n  throw e;\n}","preventionTips":["Catch EmptyResultError separately and treat it as a normal empty result.","Test the keyword interactively on web.okjike.com before automating.","Keep the Jike session logged in so restricted results are not silently hidden."],"tags":["empty-results","jike","api"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}