Skip to content

System.ArgumentOutOfRangeException: Index and length must refer to a location within the string #1354

@pinntokuru

Description

@pinntokuru

Version

v2.44.1

Flavor

CLI (Command-Line Interface)

Platform

Windows 11

Export format

JSON

Steps to reproduce

The server (invite: https://discord.gg/nhqjydaR8j) is for Japanese language learning and requires the user to pass Japanese tests to view the threads. Here's a screenshot of the thread.

Command Run:

$TOKEN = "TokenHere"
$SERVERID = "617136488840429598"
$EXPORTFORMAT = "Json"
$EXPORTDIRECTORY = "Z:\Discord-Backups\exports\TMW\%b---00-00-00\"
$MEDIADIR = "Z:\Discord-Backups\exports\TMW\_media\" 

DiscordChatExporter.Cli.exe exportguild -t $TOKEN -g $SERVERID -f $EXPORTFORMAT  --after "2023-05-22" -o $EXPORTDIRECTORY --before "2023-05-29" --media --reuse-media --markdown false --include-threads all --include-vc false --media-dir $MEDIADIR --filter ~has:invite

Things that might be causing the error:

  • The link to a channel that the user does not have access to (the No Access link)

  • The link to a user that has left the server (Xelieu in this case)

Image

Details

Error occurs for a specific thread, in https://discord.com/channels/617136488840429598/1019998042654511106/threads/1111132945210691597.

I have tried running multiple times from multiple machines, it always fails the same way at the same thread.

The same command has run successfully so far for other before/after dates that do not include this thread.

Unhandled exception. System.ArgumentOutOfRangeException: Index and length must refer to a location within the string. (Parameter 'length')
   at System.String.ThrowSubstringArgumentOutOfRange(Int32 startIndex, Int32 length)
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Spectre.Console.Rendering.Segment.SplitOverflow(Segment segment, Nullable`1 overflow, Int32 maxWidth) in /_/src/Spectre.Console/Rendering/Segment.cs:line 365
   at Spectre.Console.Paragraph.SplitLines(Int32 maxWidth) in /_/src/Spectre.Console/Widgets/Paragraph.cs:line 232
   at Spectre.Console.Paragraph.Render(RenderOptions options, Int32 maxWidth) in /_/src/Spectre.Console/Widgets/Paragraph.cs:line 141
   at Spectre.Console.TableRenderer.Render(TableRendererContext context, List`1 columnWidths) in /_/src/Spectre.Console/Widgets/Table/TableRenderer.cs:line 11
   at Spectre.Console.TableRenderer.Render(TableRendererContext context, List`1 columnWidths) in /_/src/Spectre.Console/Widgets/Table/TableRenderer.cs:line 31
   at Spectre.Console.Padder.Render(RenderOptions options, Int32 maxWidth) in /_/src/Spectre.Console/Widgets/Padder.cs:line 45
   at Spectre.Console.Rendering.LiveRenderable.Render(RenderOptions options, Int32 maxWidth)+MoveNext()
   at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
   at Spectre.Console.RenderableExtensions.GetSegments(IAnsiConsole console, RenderOptions options, IEnumerable`1 renderables) in /_/src/Spectre.Console/Extensions/RenderableExtensions.cs:line 37
   at Spectre.Console.AnsiBuilder.Build(IAnsiConsole console, IRenderable renderable) in /_/src/Spectre.Console/Internal/Backends/Ansi/AnsiBuilder.cs:line 17
   at Spectre.Console.AnsiConsoleFacade.Write(IRenderable renderable) in /_/src/Spectre.Console/Internal/Backends/AnsiConsoleFacade.cs:line 38
   at Spectre.Console.ProgressRefreshThread.Run() in /_/src/Spectre.Console/Live/Progress/ProgressRefreshThread.cs:line 45
   at System.Threading.Thread.StartCallback()

Checklist

  • I have looked through existing issues to make sure that this bug has not been reported before
  • I have provided a descriptive title for this issue
  • I have made sure that this bug is reproducible on the latest version of the application
  • I have provided all the information needed to reproduce this bug as efficiently as possible
  • I have sponsored this project
  • I have not read any of the above and just checked all the boxes to submit the issue

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions