shayaantx / botdarr

Slack/Discord/Telegram/Matrix bot for accessing radarr, sonarr, and lidarr
GNU General Public License v3.0
151 stars 13 forks source link

Unable to add movie/show using Discord #106

Closed apbrother12 closed 1 year ago

apbrother12 commented 1 year ago

Get the following error whether adding TV Show or Movie.

Could not add movie, status-code=400, reason=Bad Request

Running on a Windows machine running the jar through a batch file. Bot starts up fine, and responds to commands, however get 400 bad request from Sonarr and Radarr.

None of the log files seem to even record any errors, however I can see another issue someone has raised with the same issue, and the issue was their media folders, mine are configured as below:

sonarr-path=C:\Media\TV Shows radarr-path=C:\Media\Movies

Unless I have configured it wrong in my properties file, I think the issue is that these folders are set up as a Windows network share, which has previously caused me issues for Sonarr/Radarr, as they are unable to access folders set up as a network share, unless you install them as a service. I've tried running the batch file as admin, but this does not resolve the problem.

shayaantx commented 1 year ago

@apbrother12

I'll check on a windows machine tonight and see if I can reproduce.

The bot just calls radarr/sonarr so if you're getting errors in those *arr tools due to your path setup, not much I can do. Can you answer the following:

apbrother12 commented 1 year ago

Thanks for the reply, I have used trace logging on Radarr to see the issue, seems to be the path at fault.


2023-06-24 16:24:47.9|Debug|Api|[GET] /api/v3/movie/lookup?term=arrival&apiKey=(removed) 200.OK (1004 ms)
2023-06-24 16:24:48.0|Trace|Http|Req: 1085 [POST] /api/v3/movie?apiKey=(removed) (from 192.168.1.15 Apache-HttpClient/4.5.13 (Java/1.8.0_362))
2023-06-24 16:24:48.0|Debug|Radarr.Http.Authentication.ApiKeyAuthenticationHandler|AuthenticationScheme: API was successfully authenticated.
2023-06-24 16:24:48.0|Error|Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware|An unhandled exception has occurred while executing the request.

[v4.5.2.7388] FluentValidation.ValidationException: Validation failed: 
 -- RootFolderPath: Invalid Path: 'C:MediaMovies'
   at Radarr.Http.REST.RestController`1.ValidateResource(TResource resource, Boolean skipValidate, Boolean skipSharedValidate) in ./Radarr.Http/REST/RestController.cs:line 119
   at Radarr.Http.REST.RestController`1.OnActionExecuting(ActionExecutingContext context) in ./Radarr.Http/REST/RestController.cs:line 78
   at Microsoft.AspNetCore.Mvc.Controller.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Radarr.Http.Middleware.BufferingMiddleware.InvokeAsync(HttpContext context) in ./Radarr.Http/Middleware/BufferingMiddleware.cs:line 28
   at Radarr.Http.Middleware.IfModifiedMiddleware.InvokeAsync(HttpContext context) in ./Radarr.Http/Middleware/IfModifiedMiddleware.cs:line 41
   at Radarr.Http.Middleware.CacheHeaderMiddleware.InvokeAsync(HttpContext context) in ./Radarr.Http/Middleware/CacheHeaderMiddleware.cs:line 33
   at Radarr.Http.Middleware.StartingUpMiddleware.InvokeAsync(HttpContext context) in ./Radarr.Http/Middleware/StartingUpMiddleware.cs:line 38
   at Radarr.Http.Middleware.UrlBaseMiddleware.InvokeAsync(HttpContext context) in ./Radarr.Http/Middleware/UrlBaseMiddleware.cs:line 27
   at Radarr.Http.Middleware.VersionMiddleware.InvokeAsync(HttpContext context) in ./Radarr.Http/Middleware/VersionMiddleware.cs:line 29
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)

2023-06-24 16:24:48.0|Trace|RadarrErrorPipeline|Handling Exception
2023-06-24 16:24:48.0|Warn|RadarrErrorPipeline|Invalid request Validation failed: 
 -- RootFolderPath: Invalid Path: 'C:MediaMovies'
2023-06-24 16:24:48.1|Trace|Http|Res: 1085 [POST] /api/v3/movie?apiKey=(removed) 400.BadRequest (108 ms)
2023-06-24 16:24:48.1|Debug|Api|[POST] /api/v3/movie?apiKey=(removed) 400.BadRequest (108 ms)```
shayaantx commented 1 year ago

@apbrother12 I must be stripping out the back slashes in the windows path somewhere, I'll look tonight, and see whats going on

shayaantx commented 1 year ago

@apbrother12 what version of radarr and sonarr are you running?

I tried with sonarr 10.0.0.26733 (not latest of sonarr, last version I pulled awhile back) and it did add content

image

From sonarr.log

2023-06-24 11:46:51.7|Info|AddSeriesService|Adding Series [434752][Adventure Time: Distant Lands] Path: [G:\crashes/Adventure Time: Distant Lands]

sonarr-url=http://localhost:8989
sonarr-token=<omitted>
sonarr-path=G:\\crashes
sonarr-default-profile=any
sonarr-v4=true
apbrother12 commented 1 year ago

Wrote this reply earlier however did some additional testing:

I had noticed that too, I have changed the paths to have double backslashes, so far this has worked for Radarr, and resolved that problem. However Sonarr still doesn't want to play ball. Doesn't spit out path errors like Radarr did, looking at the logs it seems to search fine, however it just doesn't continue.

sonarr.trace.log

In the above log, you can see it search for the show (Fubar/The Diplomat), however it never gets added. I also searched in sonarr.log for "AddSeriesService", however nothing (recent) is returned.

My Radarr version is 4.5.2.7388 My Sonarr version is 3.0.10.1567

my sonarr-v4 in properties was originally set to nothing, it just exists in the file without =true or =false, the same as in your sample properties, however I have just now tried true, false and v3 incase that works too however still nothing.

shayaantx commented 1 year ago

@apbrother12 I'll try that version of sonarr tonight and debug it further, will post back when I have more answers

apbrother12 commented 1 year ago

Thanks for working with me on this so far. I can also try upgrading to Sonarr v4 to see if that does the trick.

shayaantx commented 1 year ago

@apbrother12 so there was indeed a bug specific to a file separator being used was unix only, once I fixed that I could add content with sonarr v3/v4 on windows.

I didn't look into why logs aren't outputting for you on windows, I'll try to look tomorrow at that.

Let me know of any other issues (latest release should have fix)

shayaantx commented 1 year ago

actually i broke the github actions that create new versions, one moment

shayaantx commented 1 year ago

ok now its out