Tyrrrz/DiscordChatExporter · info · ChannelEmptyException
Channel '{request.Channel.Name}' of guild '{request.Guild.Na
Error message
Channel '{request.Channel.Name}' of guild '{request.Guild.Name}' does not contain any messages; an empty file will be created. What it means
Thrown as ChannelEmptyException (a DiscordChatExporterException subclass) when request.Channel.IsEmpty is true — the channel is known to contain no messages at all. Despite being an exception, the message states an empty file WILL be created because MessageExporter is initialized before this check. Callers are expected to treat this as informational, not fatal.
Source
Thrown at DiscordChatExporter.Core/Exporting/ChannelExporter.cs:41
$"Channel '{request.Channel.Name}' "
+ $"of guild '{request.Guild.Name}' "
+ $"is a forum and cannot be exported directly. "
+ "You need to pull its threads and export them individually."
);
}
// Build context
var context = new ExportContext(discord, request);
await context.PopulateChannelsAndRolesAsync(cancellationToken);
// Initialize the exporter before further checks to ensure the file is created even if
// an exception is thrown after this point.
await using var messageExporter = new MessageExporter(context);
// Check if the channel is empty
if (request.Channel.IsEmpty)
{
throw new ChannelEmptyException(
$"Channel '{request.Channel.Name}' "
+ $"of guild '{request.Guild.Name}' "
+ $"does not contain any messages; an empty file will be created."
);
}
// Check if the 'before' and 'after' boundaries are valid
if (
(
request.Before is not null
&& !request.Channel.MayHaveMessagesBefore(request.Before.Value)
)
|| (
request.After is not null
&& !request.Channel.MayHaveMessagesAfter(request.After.Value)
)
)
{View on GitHub (pinned to f6865c8216)
Solutions
- Treat as expected: catch ChannelEmptyException and continue the batch without logging it as a failure.
- Pre-filter the channel list by skipping channels known to be empty before queuing exports.
- If you expected messages, confirm the channel ID is correct and the identity can read history.
Example fix
try
{
await exporter.ExportChannelAsync(request, progress, ct);
}
catch (ChannelEmptyException)
{
// empty file already created; continue batch
} Defensive patterns
Strategy: try-catch
Validate before calling
if (channel.IsEmpty)
logger.LogInformation("Channel {Name} is empty; skipping.", channel.Name); Type guard
static bool IsEmptyChannel(Channel c) => c.IsEmpty;
Try / catch
try { await exporter.ExportChannelAsync(req, progress, ct); }
catch (ChannelEmptyException) { logger.LogInformation("{Channel} empty — file created", req.Channel.Name); } Prevention
- Check channel.IsEmpty before exporting to skip silently.
- Catch ChannelEmptyException separately from fatal errors so batches continue.
- Expect empty files on disk even when this exception is thrown.
When it happens
Trigger: ExportChannelAsync reaches the IsEmpty guard at ChannelExporter.cs:48 after initializing MessageExporter (so the file exists on disk) but before fetching messages. request.Channel.IsEmpty was true in the channel metadata.
Common situations: Newly created channel with no messages; channel that only contains threads (no top-level messages); voice/stage channel with no text; category channel; channel whose messages were all deleted.
Related errors
- Channel '{request.Channel.Name}' of guild '{request.Guild.Na
- Export failed.
- Channel '{request.Channel.Name}' of guild '{request.Guild.Na
- Failed to export message #{message.Id} in channel '{request.
AI-assisted analysis of Tyrrrz/DiscordChatExporter@f6865c8216 (2026-08-13).
Data as JSON: /api/errors/eb612c1ef7f37955.
Report an issue: GitHub.