{"record":{"id":"42a221bdc7d198ff","repo":"Tyrrrz/DiscordChatExporter","slug":"failed-to-locate-the-channel-index-inside-the-data","errorCode":null,"errorMessage":"Failed to locate the channel index inside the data package.","messagePattern":"Failed to locate the channel index inside the data package\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"DiscordChatExporter.Core/Discord/Dump/DataDump.cs","lineNumber":52,"sourceCode":"        }\n\n        return new DataDump(channels);\n    }\n\n    public static async ValueTask<DataDump> LoadAsync(\n        string zipFilePath,\n        CancellationToken cancellationToken = default\n    )\n    {\n        await using var archive = await ZipFile.OpenReadAsync(zipFilePath, cancellationToken);\n\n        // Use case-insensitive search to accommodate for different data dump versions\n        // https://github.com/Tyrrrz/DiscordChatExporter/issues/1459\n        var entry =\n            archive.Entries.FirstOrDefault(e =>\n                e.FullName.Equals(\"messages/index.json\", StringComparison.OrdinalIgnoreCase)\n            )\n            ?? throw new InvalidOperationException(\n                \"Failed to locate the channel index inside the data package.\"\n            );\n\n        await using var stream = await entry.OpenAsync(cancellationToken);\n        using var document = await JsonDocument.ParseAsync(stream, default, cancellationToken);\n\n        return Parse(document.RootElement);\n    }\n}\n","sourceCodeStart":34,"sourceCodeEnd":62,"githubUrl":"https://github.com/Tyrrrz/DiscordChatExporter/blob/f6865c82167c3bfee4455da80a1f1ca5e71b95ad/DiscordChatExporter.Core/Discord/Dump/DataDump.cs#L34-L62","documentation":"Thrown as InvalidOperationException by DataDump.ParseAsync when the opened ZIP archive contains no entry whose full name equals 'messages/index.json' (case-insensitive). The index is the entry point for parsing a Discord data package, so without it the dump cannot be interpreted. This is a data-integrity error, not a Discord API error.","triggerScenarios":"Calling DataDump.ParseAsync with a zipFilePath that is a valid ZIP but is not a Discord data package (or is a different/incomplete version). The FirstOrDefault at DataDump.cs:48 returns null and the `??` throws.","commonSituations":"Pointing --dump at an arbitrary zip, a partial download, or a re-zipped folder that lost the original layout; an older/newer data package version that renamed the index; the user exported only the account section instead of the full package request.","solutions":["Re-download the complete data package from Discord (User Settings > Privacy & Safety > Request Data) and wait for it to finish.","Unzip and confirm `messages/index.json` exists at the archive root; re-zip preserving the directory structure if you repackaged it.","Point the command at the original, unmodified package zip."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"using var archive = await ZipFile.OpenReadAsync(zipPath, ct);\nif (!archive.Entries.Any(e => e.FullName.Equals(\"messages/index.json\", StringComparison.OrdinalIgnoreCase)))\n    throw new ArgumentException(\"ZIP is not a Discord data package (missing messages/index.json).\");","typeGuard":null,"tryCatchPattern":"try { await DataDump.ParseAsync(zipPath, ct); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"channel index\"))\n{\n    logger.LogError(\"'{Path}' is not a valid Discord data package — re-request it from Discord.\", zipPath);\n}","preventionTips":["Only pass packages produced by Discord's Request My Data feature.","Do not repackage/rezip the dump; use the original file.","Verify the archive contains messages/index.json before parsing."],"tags":["data-dump","zip","data-integrity","parsing"],"backgroundTag":null,"analyzedSha":"f6865c82167c3bfee4455da80a1f1ca5e71b95ad","analyzedAt":"2026-08-13T18:08:46.403Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}