{"record":{"id":"18e76e8ed1e6c8f6","repo":"jackwener/OpenCLI","slug":"no-posts-were-returned-for-topic-args-id-confi","errorCode":null,"errorMessage":"No posts were returned for topic ${args.id}. Confirm the topic ID and login state.","messagePattern":"No posts were returned for topic (.+?)\\. Confirm the topic ID and login state\\.","errorType":"exception","errorClass":"EmptyResultError('jike topic')","httpStatus":null,"severity":"warning","filePath":"clis/jike/topic.js","lineNumber":46,"sourceCode":"    const data = JSON.parse(el.textContent || '{}');\n    const pageProps = data?.props?.pageProps || {};\n    const posts = Array.isArray(pageProps.posts) ? pageProps.posts : [];\n    return posts.map(p => ({\n      content: (p.content || '').replace(/\\\\n/g, ' ').slice(0, 80),\n      author: p.user?.screenName || '',\n      likes: p.likeCount || 0,\n      comments: p.commentCount || 0,\n      time: p.actionTime || p.createdAt || '',\n      id: p.id || '',\n    }));\n  } catch (e) {\n    return { ok: false, reason: 'parse-error', message: e?.message || String(e) };\n  }\n})()\n`);\n        if (Array.isArray(data)) {\n            if (data.length === 0) {\n                throw new EmptyResultError('jike topic', `No posts were returned for topic ${args.id}. Confirm the topic ID and login state.`);\n            }\n            return data.slice(0, limit).map((item) => ({\n                content: item.content ?? '',\n                author: item.author ?? '',\n                likes: item.likes ?? 0,\n                comments: item.comments ?? 0,\n                time: item.time ?? '',\n                url: `https://web.okjike.com/originalPost/${item.id ?? ''}`,\n            }));\n        }\n        if (data?.reason === 'missing-data-script') {\n            throw new CommandExecutionError('Jike topic page did not expose the expected data script');\n        }\n        if (data?.reason === 'parse-error') {\n            throw new CommandExecutionError(`Failed to parse Jike topic data: ${data.message || 'unknown error'}`);\n        }\n        throw new CommandExecutionError('Jike topic returned an unreadable payload');\n    },","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jike/topic.js#L28-L64","documentation":"The jike topic CLI loads https://m.okjike.com/topics/<id> and extracts posts from an embedded JSON script. If the extraction succeeds structurally but the posts array is empty, it throws EmptyResultError telling the user the topic yielded no posts and to verify the ID and login state. This distinguishes 'page loaded but nothing there' from parse failures.","triggerScenarios":"The page's pageProps.posts array is empty — nonexistent or deleted topic ID, private/restricted topic, or a logged-out/limited session where the server renders zero posts.","commonSituations":"Copied a wrong/truncated topic ID from the URL; topic was deleted or made private; cookie session expired so m.okjike.com serves a logged-out shell with no posts; region-restricted content.","solutions":["Verify the topic ID against the topic URL (e.g. 553870e8e4b0cafb0a1bef68).","Re-login to Jike so the embedded JSON includes posts for logged-in content.","Open the topic URL in a normal browser to confirm posts exist; if not, the topic is gone/private.","Catch EmptyResultError and treat as 'no posts' rather than a hard failure."],"exampleFix":"// before\nconst rows = await runCli(['jike', 'topic', topicId]);\n// after\ntry {\n  const rows = await runCli(['jike', 'topic', topicId]);\n} catch (e) {\n  if (e.name === 'EmptyResultError') { console.warn('topic empty or inaccessible'); return []; }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// sanity-check topic id format before calling\nconst isTopicId = (id) => typeof id === 'string' && /^[0-9a-f]{24}$/.test(id);","typeGuard":null,"tryCatchPattern":"try {\n  return await runCli(['jike', 'topic', id]);\n} catch (e) {\n  if (e.name === 'EmptyResultError') { console.warn('topic empty, deleted, or needs login'); return []; }\n  throw e;\n}","preventionTips":["Copy the topic ID exactly from the topic URL (24 hex chars).","Re-login when topics you know exist come back empty.","Verify the topic still exists in a browser before automation."],"tags":["empty-results","jike","auth"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}