{"record":{"id":"8453d75a757ea710","repo":"Tyrrrz/DiscordChatExporter","slug":"request-to-url-failed-not-found","errorCode":null,"errorMessage":"Request to '{url}' failed: not found.","messagePattern":"Request to '(.+?)' failed: not found\\.","errorType":"exception","errorClass":"DiscordChatExporterException","httpStatus":404,"severity":"error","filePath":"DiscordChatExporter.Core/Discord/DiscordClient.cs","lineNumber":154,"sourceCode":"        CancellationToken cancellationToken = default\n    )\n    {\n        using var response = await GetResponseAsync(url, cancellationToken);\n\n        if (!response.IsSuccessStatusCode)\n        {\n            throw response.StatusCode switch\n            {\n                HttpStatusCode.Unauthorized => throw new DiscordChatExporterException(\n                    \"Authentication token is invalid.\",\n                    true\n                ),\n\n                HttpStatusCode.Forbidden => throw new DiscordChatExporterException(\n                    $\"Request to '{url}' failed: forbidden.\"\n                ),\n\n                HttpStatusCode.NotFound => throw new DiscordChatExporterException(\n                    $\"Request to '{url}' failed: not found.\"\n                ),\n\n                _ => throw new DiscordChatExporterException(\n                    $\"\"\"\n                    Request to '{url}' failed: {response\n                        .StatusCode.ToString()\n                        .SeparateWords(' ')\n                        .ToLowerInvariant()}.\n                    Response content: {await response.Content.ReadAsStringAsync(\n                        cancellationToken\n                    )}\n                    \"\"\",\n                    true\n                ),\n            };\n        }\n","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/Tyrrrz/DiscordChatExporter/blob/f6865c82167c3bfee4455da80a1f1ca5e71b95ad/DiscordChatExporter.Core/Discord/DiscordClient.cs#L136-L172","documentation":"Thrown as DiscordChatExporterException (non-fatal) from GetJsonResponseAsync when a request returns 404 Not Found. The requested resource (channel, guild, user, message) does not exist or is not visible to the authenticated identity. The url is interpolated into the message for diagnosis.","triggerScenarios":"Any GetJsonResponseAsync call returning HttpStatusCode.NotFound. Typical: requesting a channel/guild/user ID that was deleted, never existed, or is not reachable with the current token.","commonSituations":"Typo in a snowflake ID; channel/guild deleted between planning and export; copied an ID from the wrong Discord surface (e.g., a message ID used where a channel ID was needed); bot removed from the guild so its routes 404.","solutions":["Re-copy the ID with Developer Mode enabled (right-click > Copy ID).","Confirm the channel/guild still exists and the identity can see it.","Distinguish ID types: guild ID vs channel ID vs message ID — use the correct one for each command.","Remove stale IDs from your export list."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!Snowflake.TryParse(channelIdRaw, null).HasValue)\n    throw new ArgumentException($\"'{channelIdRaw}' is not a valid snowflake.\");\nvar channel = await discord.TryGetChannelAsync(guildId, channelId, ct);\nif (channel is null) throw new ArgumentException($\"Channel {channelId} not found/visible.\");","typeGuard":null,"tryCatchPattern":"try { await exporter.ExportChannelAsync(req, progress, ct); }\ncatch (DiscordChatExporterException ex) when (ex.Message.Contains(\"not found\"))\n{\n    logger.LogWarning(\"Channel {Id} not found — skipping\", req.Channel.Id);\n}","preventionTips":["Copy IDs via Developer Mode > Copy ID, not from URLs.","Validate snowflake format before queuing an export.","Filter out deleted channel IDs from saved export lists."],"tags":["not-found","discord-api","http-404","identifiers"],"backgroundTag":null,"analyzedSha":"f6865c82167c3bfee4455da80a1f1ca5e71b95ad","analyzedAt":"2026-08-13T18:08:46.403Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}