Tyrrrz/DiscordChatExporter · error · CommandException
Export failed.
Error message
Export failed.
What it means
Thrown as a CommandException at the end of ExportAsync only when EVERY channel in the batch failed to export (errorsByChannel.Count >= unwrappedChannels.Count). Partial failures are tolerated and reported per-channel to stderr; this final throw only occurs when no channel succeeded. The actual per-channel root causes are printed to the console just before this exception.
Source
Thrown at DiscordChatExporter.Cli/Commands/Base/ExportCommandBase.cs:365
using (console.WithForegroundColor(ConsoleColor.Red))
{
await console.Error.WriteLineAsync("Failed to export the following channel(s):");
}
foreach (var (channel, message) in errorsByChannel)
{
await console.Error.WriteAsync($"{channel.GetHierarchicalName()}: ");
using (console.WithForegroundColor(ConsoleColor.Red))
await console.Error.WriteLineAsync(message);
}
await console.Error.WriteLineAsync();
}
// Fail the command only if ALL channels failed to export.
// If only some channels failed to export, it's okay.
if (errorsByChannel.Count >= unwrappedChannels.Count)
throw new CommandException("Export failed.");
}
public override async ValueTask ExecuteAsync(IConsole console)
{
// Support Ukraine callout
if (!IsUkraineSupportMessageDisabled)
{
console.Output.WriteLine(
"┌────────────────────────────────────────────────────────────────────┐"
);
console.Output.WriteLine(
"│ Thank you for supporting Ukraine <3 │"
);
console.Output.WriteLine(
"│ │"
);
console.Output.WriteLine(
"│ As Russia wages a genocidal war against my country, │"View on GitHub (pinned to f6865c8216)
Solutions
- Read the per-channel error lines printed immediately above this message — they carry the real cause (401/403/404/empty).
- Verify the token still works with a single exportchat on one channel before re-running the batch.
- Check network connectivity and Discord status; retry with a lower --parallel value.
- Confirm the bot/user has access and the MESSAGE_CONTENT intent is enabled for bot tokens.
Defensive patterns
Strategy: try-catch
Validate before calling
// Preflight: prove the token works on one channel before the batch
try { await exporter.ExportChannelAsync(singleChannelRequest, null, ct); }
catch (Exception ex) { Console.Error.WriteLine($"Preflight failed: {ex.Message}"); return; } Try / catch
try
{
await cli.ExecuteAsync(args);
}
catch (CommandException ex) when (ex.Message == "Export failed.")
{
// all channels failed — consult stderr above for per-channel causes
logger.LogError("All channels failed; see per-channel errors above");
} Prevention
- Run a single-channel export first to validate token/intent/network.
- Capture stderr to correlate per-channel errors with the final failure.
- Use --parallel 1 to make rate-limit-related failures visible and ordered.
When it happens
Trigger: A multi-channel export where each channel's try/except in the export loop caught an exception and added it to errorsByChannel, and the count meets or exceeds unwrappedChannels.Count. Most commonly every channel hit the same systemic fault (bad token, no network, missing intent).
Common situations: Expired or revoked token used for a whole-guild export; MESSAGE_CONTENT intent disabled so every channel returns empty/forbidden; corporate firewall blocking discord.com; rate-limited IP with all channels 429-ing; wrong guild ID so every channel 404s.
Related errors
- Option --reuse-media cannot be used without --media.
- Option --media-dir cannot be used without --media.
- Attempted to export multiple channels, but the output path i
- Invalid snowflake '{value}'.
- Channel '{request.Channel.Name}' of guild '{request.Guild.Na
AI-assisted analysis of Tyrrrz/DiscordChatExporter@f6865c8216 (2026-08-13).
Data as JSON: /api/errors/fcc112428cbb8fe7.
Report an issue: GitHub.