Splamy / TS3AudioBot

Advanced Musicbot for Teamspeak 3
https://splamy.de/TSAudioBot/Home
Open Software License 3.0
701 stars 140 forks source link

Sometimes an error crashes after executing various commands. One of them here. #992

Open devangerpl opened 2 years ago

devangerpl commented 2 years ago

Describe the bug After a longer operation of the music bot, the user performed the function of adding a playlist with songs and dropping music bots.

To Reproduce none

Version 0.12.0

Platform linux

Log


2022-06-02 12:43:22.1209|ERROR|11|Bot.TryCatchCommand Unexpected command error: Value cannot be null. (Parameter 'source')
System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
   at TS3AudioBot.ResourceFactories.Youtube.YoutubeResolver.GetPlaylistYoutubeDl(String id, String url)
   at TS3AudioBot.ResourceFactories.Youtube.YoutubeResolver.GetPlaylist(ResolveContext _, String url)
   at TS3AudioBot.ResourceFactories.ResourceResolver.LoadPlaylistFrom(ResolveContext ctx, String message, String audioType)
   at TS3AudioBot.MainCommands.YtListImport(PlaylistManager playlistManager, ResolveContext resolver, String listId, String link)
   at TS3AudioBot.CommandSystem.Commands.FunctionCommand.ExecuteFunction(Object[] parameters)
   at TS3AudioBot.CommandSystem.Commands.FunctionCommand.Execute(ExecutionInformation info, IReadOnlyList`1 arguments)
   at TS3AudioBot.CommandSystem.BotCommand.Execute(ExecutionInformation info, IReadOnlyList`1 arguments)
   at TS3AudioBot.CommandSystem.Commands.CommandGroup.Execute(ExecutionInformation info, IReadOnlyList`1 arguments)
   at TS3AudioBot.CommandSystem.Commands.RootCommand.Execute(ExecutionInformation info, IReadOnlyList`1 arguments)
   at TS3AudioBot.CommandSystem.CommandManager.Execute(ExecutionInformation info, String command)
   at TS3AudioBot.Bot.<>c__DisplayClass42_0.<<CallScript>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at TS3AudioBot.Bot.TryCatchCommand(ExecutionInformation info, Boolean answer, Func`1 action)
2022-06-02 12:43:22.1632|FATAL|11|Core.UnhandledExceptionHandler Critical program failure!
System.ArgumentNullException: Value cannot be null. (Parameter 'input')
   at System.Text.RegularExpressions.ThrowHelper.ThrowArgumentNullException(ExceptionArgument arg)
   at System.Text.RegularExpressions.Regex.Split(String input)
   at TS3AudioBot.CommandSystem.Text.TextModBuilder.AppendFormat(AppliedTextMod format, AppliedTextMod[] para)
   at TS3AudioBot.Bot.TryCatchCommand(ExecutionInformation info, Boolean answer, Func`1 action)
   at TS3AudioBot.Bot.CallScript(ExecutionInformation info, String command, Boolean answer, Boolean skipRights)
   at TS3AudioBot.Bot.OnMessageReceived(Object sender, TextMessage textMessage)
   at TS3AudioBot.Ts3Client.ExtendedTextMessage(Object sender, TextMessage textMessage)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
   at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
2022-06-02 12:43:22.1707| INFO|11|Core.StopAsync TS3AudioBot shutting down.
devangerpl commented 2 years ago
022-06-08 18:26:11.4613|ERROR|21|Bot.TryCatchCommand Unexpected command error: Could not find a part of the path '/home/cluster-bot/bots/bot1/playlists/[URL]https:/www.youtube.com/watch?v=Mb3tyjibXCg&list=RDMb3tyjibXCg&start_radio=1&rv=Mb3tyjibXCg&t=0&ab_channel=Mata['.
System.IO.DirectoryNotFoundException: Could not find a part of the path '/home/cluster-bot/bots/bot1/playlists/[URL]https:/www.youtube.com/watch?v=Mb3tyjibXCg&list=RDMb3tyjibXCg&start_radio=1&rv=Mb3tyjibXCg&t=0&ab_channel=Mata['.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
   at System.IO.Enumeration.FileSystemEnumerableFactory.FileInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized)
   at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at TS3AudioBot.Playlists.PlaylistIO.ListPlaylists(String pattern)
   at TS3AudioBot.Playlists.PlaylistManager.GetAvailablePlaylists(String pattern)
   at TS3AudioBot.MainCommands.CommandListList(PlaylistManager playlistManager, String pattern)
--- End of stack trace from previous location ---
   at TS3AudioBot.CommandSystem.Commands.FunctionCommand.ExecuteFunction(Object[] parameters)
   at TS3AudioBot.CommandSystem.Commands.FunctionCommand.Execute(ExecutionInformation info, IReadOnlyList`1 arguments)
   at TS3AudioBot.CommandSystem.BotCommand.Execute(ExecutionInformation info, IReadOnlyList`1 arguments)
   at TS3AudioBot.CommandSystem.Commands.CommandGroup.Execute(ExecutionInformation info, IReadOnlyList`1 arguments)
   at TS3AudioBot.CommandSystem.Commands.RootCommand.Execute(ExecutionInformation info, IReadOnlyList`1 arguments)
   at TS3AudioBot.CommandSystem.CommandManager.Execute(ExecutionInformation info, String command)
   at TS3AudioBot.Bot.<>c__DisplayClass42_0.<<CallScript>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at TS3AudioBot.Bot.TryCatchCommand(ExecutionInformation info, Boolean answer, Func`1 action)
2022-06-08 18:26:11.4901|FATAL|21|Core.UnhandledExceptionHandler Critical program failure!
System.ArgumentNullException: Value cannot be null. (Parameter 'input')
   at System.Text.RegularExpressions.ThrowHelper.ThrowArgumentNullException(ExceptionArgument arg)
   at System.Text.RegularExpressions.Regex.Split(String input)
   at TS3AudioBot.CommandSystem.Text.TextModBuilder.AppendFormat(AppliedTextMod format, AppliedTextMod[] para)
   at TS3AudioBot.Bot.TryCatchCommand(ExecutionInformation info, Boolean answer, Func`1 action)
   at TS3AudioBot.Bot.CallScript(ExecutionInformation info, String command, Boolean answer, Boolean skipRights)
   at TS3AudioBot.Bot.OnMessageReceived(Object sender, TextMessage textMessage)
   at TS3AudioBot.Ts3Client.ExtendedTextMessage(Object sender, TextMessage textMessage)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi)
   at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state)
   at System.Threading.QueueUserWorkItemCallback.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
2022-06-08 18:26:11.5113| INFO|21|Core.StopAsync TS3AudioBot shutting down.
Flakebi commented 2 years ago

For the record, I get similar exceptions with a !list list [URL]https:/www.youtube.com/watch?v=Mb3tyjibXCg&list=RDMb3tyjibXCg&start_radio=1&rv=Mb3tyjibXCg&t=0&ab_channel=Mata[/URL] command. However, the bot does not crash for me.

I could reproduce the fatal error/crash when commenting out the error_call_unexpected_error block in Localization/strings.resx. Could it be that you are using a translation (that doesn’t have this string)?

Anyway, this should not crash the bot. I’ll work on a fix.

Flakebi commented 2 years ago

Looking more into the problem, it looks like something is different with your install or translation. For me, translated strings are displayed in the set language if possible, or in english if no translation is available. But I can’t find a case where null is returned, it should always fall back to english. Do you use a modified or self-compiled version by chance?