{"record":{"id":"8893411b663ef51d","repo":"jackwener/OpenCLI","slug":"discord-app-threads","errorCode":null,"errorMessage":"discord-app threads","messagePattern":"discord-app threads","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/discord-app/threads.js","lineNumber":29,"sourceCode":"    name: 'threads',\n    access: 'read',\n    description: 'List visible Discord forum/thread posts in the active or targeted channel',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'limit', required: false, default: '30', help: 'Maximum thread/post cards to return (default: 30)' },\n        { name: 'guild', required: false, help: 'Guild/server id or visible name for targeted thread listing' },\n        { name: 'channel', required: false, help: 'Forum/channel id or visible name for targeted thread listing' },\n        { name: 'url', required: false, help: 'Discord forum/channel URL to open before listing threads' },\n    ],\n    columns: ['Index', 'Thread', 'Author', 'Updated', 'Preview', 'guild_id', 'channel_id', 'thread_id', 'url'],\n    func: async (page, kwargs) => {\n        const limit = parsePositiveInt(kwargs.limit, 30, 'limit');\n        await maybeNavigateToDiscordChannel(page, kwargs, { waitForContent: 'threads', contentTimeoutMs: 3000 });\n        const rows = await listDiscordThreads(page, limit);\n        if (rows.length === 0) {\n            throw new EmptyResultError('discord-app threads', 'No visible forum/thread posts were found in the selected Discord channel.');\n        }\n        return rows;\n    },\n});\n\nexport const __test__ = {\n    threadsCommand,\n};\n","sourceCodeStart":11,"sourceCodeEnd":38,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/discord-app/threads.js#L11-L38","documentation":"The 'discord-app threads' command throws EmptyResultError when listDiscordThreads(page, limit) returns no visible forum/thread posts for the selected channel. The library signals this as a failure because a channel targeted as containing threads should render at least one post; an empty result usually means navigation or rendering failed. It protects callers from treating an empty scrape as success.","triggerScenarios":"Running `discord-app threads` where the target channel has no visible forum/thread posts, the channel is not a forum/threads channel, navigation waited only 3 seconds for thread content and the grid never rendered, or the threads DOM script matched nothing.","commonSituations":"Using --url/--guild/--channel pointing at a normal text channel with no forum posts; slow loading in CI exceeding the 3s content timeout; all threads filtered/collapsed in the UI; Discord UI update changing forum-grid selectors.","solutions":["Verify the target channel is a forum or contains thread posts, and that posts are visible in the automated browser","Increase the content timeout / wait for the forum grid to render before scraping (maybeNavigateToDiscordChannel waitForContent 'threads' currently waits 3s)","Check the channel isn't empty or fully archived in the Discord client","Update buildListThreadsScript selectors in clis/discord-app/utils.js if the Discord forum UI changed"],"exampleFix":"// before\nawait discordAppThreads(page, { url: channelUrl });\n// after\nawait maybeNavigateToDiscordChannel(page, { url: channelUrl }, { waitForContent: 'threads', contentTimeoutMs: 10000 });\nawait discordAppThreads(page, { url: channelUrl });","handlingStrategy":"validation","validationCode":"function validateThreadsTarget(kwargs) {\n  if (kwargs.url && !/discord\\.com\\/channels\\/\\d+\\/\\d+/.test(kwargs.url)) {\n    throw new Error('--url must be a Discord channel URL');\n  }\n}","typeGuard":"function hasThreads(rows) {\n  return Array.isArray(rows) && rows.length > 0;\n}","tryCatchPattern":"try {\n  const rows = await discordAppThreads(page, { url: channelUrl, limit: 30 });\n} catch (err) {\n  if (String(err.message).includes('discord-app threads')) {\n    console.error('No visible threads: check the channel is a forum/has posts and content finished loading.');\n  } else throw err;\n}","preventionTips":["Target forum channels that actually contain visible thread posts","Allow extra wait time for the forum grid to render (default content wait is only 3s)","Retry once after full load before concluding the channel is empty","Re-check selectors after Discord UI updates"],"tags":["discord","empty-result","forum"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}