question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

500: Internal Server Error - breaks the whole thing

See original GitHub issue

After receiving a server error 500 the whole bot stops to function correctly, it’s no longer receiving any messages, but it can still send them… This happened last night on several bots with completely different code, and even different version of Discord.NET (one with the latest commit on dev, the other with a bit outdated nuget…) So I guess that it’s safe to assume that it’s Discord server issue, however, the library should probably correctly handle it - adding another hack (if 500 then exit) doesn’t seem like the right solution, even as far as hacks go…

This stack started with client.GetGuild(guid)

May 25 03:20:10 Keyra dotnet[29615]: Exception: The server responded with error 500: 500: Internal Server Error
May 25 03:20:10 Keyra dotnet[29615]: Stack:    at Discord.Net.Queue.RequestBucket.<SendAsync>d__18.MoveNext()
May 25 03:20:10 Keyra dotnet[29615]: --- End of stack trace from previous location where exception was thrown ---
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
May 25 03:20:10 Keyra dotnet[29615]:    at Discord.Net.Queue.RequestQueue.<SendAsync>d__14.MoveNext()
May 25 03:20:10 Keyra dotnet[29615]: --- End of stack trace from previous location where exception was thrown ---
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
May 25 03:20:10 Keyra dotnet[29615]:    at Discord.API.DiscordRestApiClient.<SendInternalAsync>d__62.MoveNext()
May 25 03:20:10 Keyra dotnet[29615]: --- End of stack trace from previous location where exception was thrown ---
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
May 25 03:20:10 Keyra dotnet[29615]:    at Discord.API.DiscordRestApiClient.<SendAsync>d__57`1.MoveNext()
May 25 03:20:10 Keyra dotnet[29615]: --- End of stack trace from previous location where exception was thrown ---
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
May 25 03:20:10 Keyra dotnet[29615]:    at Discord.API.DiscordRestApiClient.<GetChannelMessageAsync>d__75.MoveNext()
May 25 03:20:10 Keyra dotnet[29615]: --- End of stack trace from previous location where exception was thrown ---
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
May 25 03:20:10 Keyra dotnet[29615]:    at Discord.Rest.ChannelHelper.<GetMessageAsync>d__6.MoveNext()
May 25 03:20:10 Keyra dotnet[29615]: --- End of stack trace from previous location where exception was thrown ---
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
May 25 03:20:10 Keyra dotnet[29615]:    at Discord.WebSocket.SocketTextChannel.<GetMessageAsync>d__19.MoveNext()
May 25 03:20:10 Keyra dotnet[29615]: --- End of stack trace from previous location where exception was thrown ---
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
May 25 03:20:10 Keyra dotnet[29615]:    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
May 25 03:20:10 Keyra dotnet[29615]:    at Botwinder.Service.SkywinderClient.<MainUpdate>d__8.MoveNext() in /home/project/Botwinder.service/Bot.cs:line 64

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
FiniteRealitycommented, May 27, 2018

Like… if something then if something then if something then if something then do something? No thanks 😄

I was suggesting something like this instead:

var mainGuild = this.Client.GetGuild(this.Config.MainGuildId);
var statusChannel = mainGuild?.GetTextChannel(this.Config.StatusChannelId);

if (mainGuild != null && statusChannel != null)
{
    var statusMessage = await.GetMessageAsync(this.Config.StatusMessageId);
    if (statusMessage != null)
    {
        // code here
    }
}

Don’t put assignments in if statements. It’ll only serve to confuse you later on.

0reactions
foxbotcommented, May 27, 2018

hey kids please don’t fight on my github issue, this has been answered, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix a 500 Internal Server Error on Your Site
1. Try Reloading the Page. This might seem a little obvious to some, but one of the easiest and first things you should...
Read more >
HTTP 500 Internal Server Error: What It Means & How to Fix It
An HTTP 500 internal server error is a general error message. It covers unexpected issues that don't fit into existing error codes. HTTP...
Read more >
How to Fix a 500 Internal Server Error
The 500 Internal Server Error is a very general HTTP status code that means something has gone wrong on the website's server, but...
Read more >
What is a 500 Internal Server Error?
The 500 Internal Server Error is simply a general indication that something's wrong on the server side. Several things could cause this, but...
Read more >
What Is a 500 Internal Server Error, and How Do I Fix It?
A 500 Internal Server error means that the website you were trying to connect to has experienced a problem and can't provide a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found