jackwener/OpenCLI · warning · EmptyResultError
discord-app read
Error message
discord-app read
What it means
The discord-app read command validates that scraped message rows actually belong to the requested target via assertDiscordMessageRowsBelongToTarget, then throws EmptyResultError('discord-app read') if the (validated) message list is empty. This distinguishes a genuinely empty channel from rows that were filtered out as mismatched.
Source
Thrown at clis/discord-app/read.js:34
strategy: Strategy.UI,
browser: true,
args: [
{ name: 'count', required: false, help: 'Number of messages to read (default: 20)', default: '20' },
{ name: 'guild', required: false, help: 'Guild/server id or visible name for targeted reads' },
{ name: 'channel', required: false, help: 'Channel id or visible name for targeted reads' },
{ name: 'url', required: false, help: 'Discord channel URL to open before reading' },
],
columns: ['Author', 'Time', 'Message', 'channel_id', 'message_id'],
func: async (page, kwargs) => {
const count = parsePositiveInt(kwargs.count, 20, 'count');
const target = await maybeNavigateToDiscordChannel(page, kwargs, { waitForContent: 'messages' });
const messages = assertDiscordMessageRowsBelongToTarget(
await readDiscordMessages(page, count),
target,
'Discord channel read',
);
if (messages.length === 0) {
throw new EmptyResultError('discord-app read', 'No messages were found in the selected Discord channel.');
}
return messages;
},
});
export const __test__ = {
readCommand,
};
View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the channel is the intended one and actually has messages (check in the Discord UI).
- Send a test message to the channel, then re-run the read.
- Check channel permission (View Message History) for the logged-in account.
- Ensure the page has finished loading; retry after a longer wait.
Example fix
// before
await run('discord-app read --count=20');
// after: confirm channel has content first
await run('discord-app send --text="ping"');
const msgs = await run('discord-app read --count=20'); Defensive patterns
Strategy: validation
Validate before calling
// confirm the channel has history before reading
const bodyText = await page.evaluate('document.body.innerText');
if (!bodyText.trim()) throw new Error('Channel appears empty or not loaded'); Type guard
function hasMessages(rows) { return Array.isArray(rows) && rows.length > 0; } Try / catch
try {
const msgs = await run('discord-app read --count=20');
} catch (e) {
if (/discord-app read/.test(e.message)) {
// channel is genuinely empty or wrong target — verify target, send a test message, retry
await verifyChannelTarget();
}
} Prevention
- Verify the target channel name/ID before reading.
- Wait for message list to render on slow connections.
- Check View Message History permission for the account.
- Send a sentinel message before reading in automated tests.
When it happens
Trigger: Running 'discord-app read' on a channel with no messages (fresh/new channel, or all messages deleted), or after target-assertion filtering removed rows that didn't belong to the requested channel/author so zero rows remain.
Common situations: Reading a just-created channel; count/request scrolled an empty region; account lacks permission to view history so the pane renders empty; targeting the wrong channel by mistake.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- discord-app channels
- 1point3acres thread
- 1point3acres user
- amazon ${definition.commandName} did not expose any ranked i
- amazon search did not expose any product cards
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/23e72ec05e6a11ff.
Report an issue: GitHub.