kiranshila / Doplarr

An *arr request bot for Discord
MIT License
410 stars 30 forks source link

Requesting existing movie results in unspecified error #60

Open stephanrenggli opened 2 years ago

stephanrenggli commented 2 years ago

Describe the bug If a movie is already added to radarr and it is requested again through doplarr, the request will result in the error message Unspecified error on request, check logs.

The log message shows "errorMessage" "This movie has already been added" (see full log below).

Expected behavior This should not result in an error but be handled gracefully and shown to the discord user issuing the command.

Possible solutions:

The first option is probably the easiest and most user friendly one.

Screenshots none

Logs Please copy out the log in it's entirety, please make sure to hide any potential secrets/API keys - although they should be censored via the logging program.

2022-02-19T13:40:50.244Z 73d17e4cbef0 INFO [doplarr.interaction-state-machine:28] - Performing search for movie the batman
2022-02-19T13:40:58.629Z 73d17e4cbef0 FATAL [doplarr.interaction-state-machine:124] - Non 403 error on request {:mention-everyone false, :mentions [], :application-id "secret", :pinned false, :content "Unspecified error on request, check logs", :attachments [], :webhook-id "secret", :mention-roles [], :type 20, :interaction {:id "secret", :type 2, :name "request", :user {:id "secret", :username "secret", :avatar "secret", :discriminator "secret", :public-flags 256}}, :author {:id "secret", :username "doplarr", :avatar "secret", :discriminator "secret", :public-flags 0, :bot true}, :components [], :id "secret", :channel-id "secret", :embeds [], :timestamp "2022-02-19T13:40:50.151000+00:00", :flags 64, :tts false, :edited-timestamp "2022-02-19T13:40:58.554363+00:00"} {:request-time 11, :request {:user-info nil, :as :json-string-keys, :headers {"X-API-Key" "secret", "content-type" "application/json", "accept-encoding" "gzip, deflate"}, :server-port 7878, :url "http://radarr:7878/api/v3/movie", :content-type "application/json", :coerce :always, :http-request #object[jdk.internal.net.http.HttpRequestImpl 0x6d17598c "http://radarr:7878/api/v3/movie POST"], :uri "/api/v3/movie", :server-name "radarr", :query-string nil, :body "{\"title\":\"The Batman\",\"tmdbId\":414906,\"qualityProfileId\":4,\"monitored\":true,\"rootFolderPath\":\"/zpool/radarr\",\"addOptions\":{\"searchForMovie\":true}}", :scheme :http, :async? true, :request-method :post}, :http-client #object[jdk.internal.net.http.HttpClientFacade 0x63d0ba5e "jdk.internal.net.http.HttpClientImpl@4825c646(21)"], :headers {"cache-control" "no-cache,no-store", "content-type" "application/json", "date" "Sat, 19 Feb 2022 13:40:58 GMT", "expires" "-1", "pragma" "no-cache", "server" "Kestrel", "transfer-encoding" "chunked"}, :status 400, :content-type :application/json, :uri "http://radarr:7878/api/v3/movie", :content-type-params {}, :version :http-1.1, :body [{"propertyName" "TmdbId", "errorMessage" "This movie has already been added", "attemptedValue" 414906, "severity" "error", "errorCode" "MovieExistsValidator", "formattedMessageArguments" [], "formattedMessagePlaceholderValues" {"propertyName" "Tmdb Id", "propertyValue" 414906}}]}

Additional context

stephanrenggli commented 2 years ago

Your bug issue template specifies Please copy out the log in it's entirety, please make sure to hide any potential secrets/API keys - although they should be censored via the logging program. but I have had to manually remove API keys, etc. I copied the log from the stdout in portainer so this might only be a problem in my specific setup or with the linuxserver.io container.

kiranshila commented 2 years ago

Yeah secrets in the log is a bug which I can work on.

Radarr throwing a 400 on duplicate requests is new as we're handling media status. Perhaps that got recently changed in an API update. I'll look into it.

kiranshila commented 2 years ago

In fact, it should be checking the status before trying to perform the request, so something strange is indeed happening.

azzuron commented 2 years ago

I just did a duplicate request and i did not get the mentioned error here. I did have to get all the way through and click "Request" button to find out it was already in the system however. If possible it maybe optimal to just indicate the movie is already available after choosing it from the first drop down box.

vtyr commented 2 years ago

I'm also experiencing this issue when media already exists.

Discord: Unspecified error on request, check logs

Logs: Same as OP. The logs do say the media exists, so would be nice to pipe this through to Discord if possible

kiranshila commented 2 years ago

Can you post the logs? It should be coming through

zodac commented 1 year ago

Also saw this error, the log errors are below. Running in docker if that matters

radarr:

radarr | [v4.1.0.6175] FluentValidation.ValidationException: Validation failed: radarr | -- TmdbId: This movie has already been added radarr | at Radarr.Http.REST.RestController1.ValidateResource(TResource resource, Boolean skipValidate, Boolean skipSharedValidate) in D:\a\1\s\src\Radarr.Http\REST\RestController.cs:line 113 radarr | at Radarr.Http.REST.RestController1.OnActionExecuting(ActionExecutingContext context) in D:\a\1\s\src\Radarr.Http\REST\RestController.cs:line 72 radarr | at Microsoft.AspNetCore.Mvc.Controller.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) radarr | at Microsoft.AspNetCore.Mvc.Filters.ControllerActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) radarr | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) radarr | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() radarr | --- End of stack trace from previous location --- radarr | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) radarr | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) radarr | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) radarr | at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) radarr | at Radarr.Http.Middleware.BufferingMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Radarr.Http\Middleware\BufferingMiddleware.cs:line 27 radarr | at Radarr.Http.Middleware.IfModifiedMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Radarr.Http\Middleware\IfModifiedMiddleware.cs:line 40 radarr | at Radarr.Http.Middleware.CacheHeaderMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Radarr.Http\Middleware\CacheHeaderMiddleware.cs:line 32 radarr | at Radarr.Http.Middleware.UrlBaseMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Radarr.Http\Middleware\UrlBaseMiddleware.cs:line 26 radarr | at Radarr.Http.Middleware.VersionMiddleware.InvokeAsync(HttpContext context) in D:\a\1\s\src\Radarr.Http\Middleware\VersionMiddleware.cs:line 27 radarr | at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context) radarr | at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult) radarr | at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) radarr | at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) radarr | at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task) radarr | radarr | radarr | [Warn] RadarrErrorPipeline: Invalid request Validation failed: radarr | -- TmdbId: This movie has already been added

doplarr:

doplarr | 2022-08-19T00:17:43.633Z doplarr FATAL [doplarr.interaction-state-machine:124] - Non 403 error on request {:mention-everyone false, :mentions [], :application-id "1009972058106630154", :pinned false, :content "Unspecified error on request, check logs", :attachments [], :webhook-id "1009972058106630154", :mention-roles [], :type 20, :interaction {:id "1009979357923655692", :type 2, :name "request movie", :user {:id "229182920630337536", :username "zodac", :avatar "6962349978f7c314a069b8211f9fc8d2", :avatar-decoration nil, :discriminator "8933", :public-flags 0}}, :author {:id "1009972058106630154", :username "Doplarr", :avatar "bc0f16c8fbab425f9656db43018a21f9", :avatar-decoration nil, :discriminator "7109", :public-flags 0, :bot true}, :components [], :id "1009979359739789332", :channel-id "1009970165800255541", :embeds [], :timestamp "2022-08-19T00:17:23.871000+00:00", :flags 64, :tts false, :edited-timestamp "2022-08-19T00:17:42.547177+00:00"} {:request-time 219, :request {:user-info nil, :as :json-string-keys, :headers {"X-API-Key" "205f5124e2a9460f9139121562c4eca3", "content-type" "application/json", "accept-encoding" "gzip, deflate"}, :server-port 7878, :url "http://radarr:7878/api/v3/movie", :content-type "application/json", :coerce :always, :http-request #object[jdk.internal.net.http.HttpRequestImpl 0x68cadd35 "http://radarr:7878/api/v3/movie POST"], :uri "/api/v3/movie", :server-name "radarr", :query-string nil, :body "{\"title\":\"The Bourne Identity\",\"tmdbId\":2501,\"qualityProfileId\":4,\"rootFolderPath\":\"/movies\",\"monitored\":true,\"addOptions\":{\"searchForMovie\":true}}", :scheme :http, :async? true, :request-method :post}, :http-client #object[jdk.internal.net.http.HttpClientFacade 0x643a8755 "jdk.internal.net.http.HttpClientImpl@11d5fa2e(27)"], :headers {"cache-control" "no-cache,no-store", "content-type" "application/json", "date" "Fri, 19 Aug 2022 00:17:42 GMT", "expires" "-1", "pragma" "no-cache", "server" "Kestrel", "transfer-encoding" "chunked"}, :status 400, :content-type :application/json, :uri "http://radarr:7878/api/v3/movie", :content-type-params {}, :version :http-1.1, :body [{"propertyName" "TmdbId", "errorMessage" "This movie has already been added", "attemptedValue" 2501, "severity" "error", "errorCode" "MovieExistsValidator", "formattedMessageArguments" [], "formattedMessagePlaceholderValues" {"propertyName" "Tmdb Id", "propertyValue" 2501}}]}

kiranshila commented 1 year ago

Ah, there's a new version of the radar API. Great.