mdhiggins / radarr-sma

MIT License
24 stars 13 forks source link

RadarrPostProcess - ERROR - Radarr monitor status update failed. #19

Closed preacher65 closed 3 years ago

preacher65 commented 3 years ago

I'm experiencing an issue when trying to use the radarr-sma docker. Not sure if it's the script or my config, I suspect the latter but would appreciate any assistance or advice on next troubleshooting steps. (This seems to have been happening since 13th Feb, I don't have a change log so not sure if I changed anything at this end on that date.)

I'm running the latest nightly and I have checked the radarr API key is correct in autoprocess.ini (although I think that should be set automatically?) Using linuxserver/sabnzbd as the downloader

Full autoprocess.ini is at https://pastebin.com/G6WvRBrm in case it's relevant

When processing a file, after conversion completes I get the following error in sma.log:

2021-02-21 16:10:59 - RadarrPostProcess - ERROR - Radarr monitor status update failed.
Traceback (most recent call last):
  File "/usr/local/sma/postRadarr.py", line 165, in <module>
    if rescanAndWait(host, port, webroot, apikey, protocol, movieid, log):
  File "/usr/local/sma/postRadarr.py", line 24, in rescanAndWait
    log.info("Radarr response Rescan command: ID %d %s." % (rstate['id'], rstate['state']))
KeyError: 'id'

And a corresponding error in the radarr log:

Request Failed. POST /api/command: The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.movieId | LineNumber: 0 | BytePositionInLine: 40.
System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.movieId | LineNumber: 0 | BytePositionInLine: 40.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number.
   at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& value)
   at System.Text.Json.Utf8JsonReader.GetInt32()
   at System.Text.Json.Serialization.Converters.NullableConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCoreAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)
   at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)
   at NzbDrone.Common.Serializer.STJson.Deserialize(Stream input, Type type) in D:\a\1\s\src\NzbDrone.Common\Serializer\System.Text.Json\STJson.cs:line 50
   at Radarr.Http.Extensions.ReqResExtensions.FromJson(Stream body, Type type) in D:\a\1\s\src\Radarr.Http\Extensions\ReqResExtensions.cs:line 31
   at NzbDrone.Api.Commands.CommandModule.StartCommand(CommandResource commandResource) in D:\a\1\s\src\NzbDrone.Api\Commands\CommandModule.cs:line 56
   at Radarr.Http.REST.RestModule`1.<set_CreateResource>b__43_0(Object options) in D:\a\1\s\src\Radarr.Http\REST\RestModule.cs:line 206
   at Nancy.NancyModule.<>c__DisplayClass38_0`1.<Post>b__0(Object args)
   at Nancy.NancyModule.<>c__DisplayClass40_0`1.<Post>b__0(Object args, CancellationToken ct)
   at Nancy.Routing.Route`1.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken)
   at Nancy.Routing.DefaultRouteInvoker.Invoke(Route route, CancellationToken cancellationToken, DynamicDictionary parameters, NancyContext context)
   at Nancy.Routing.DefaultRequestDispatcher.Dispatch(NancyContext context, CancellationToken cancellationToken)
   at Nancy.NancyEngine.InvokeRequestLifeCycle(NancyContext context, CancellationToken cancellationToken, IPipelines pipelines)
mdhiggins commented 3 years ago

I wonder if Radarr broke something in their nightly build

I made a few small changes to postRadarr/postSonarr in this update that will print out some more information before this failure in the debug level logging

cf09e2f0fd3fd4def4e01370a5238cc43ca603e3 ce25248a9bd7a2775851355ff92900cef3b6d4d3

If you could rerun this job with debug level logging and these new updates I can try and see why this is failiing

I'm also in the process of migrating the docker containers build from hub's automated build to github actions in order to support more architectures but haven't quite finished that

You can use the SMA_UPDATE environment variable set to true to update SMA with a container restart without needing a new build

https://github.com/mdhiggins/sickbeard_mp4_automator/wiki/Debug-Level-Logging

That's how to enable debug level logging

preacher65 commented 3 years ago

Thanks. The sma log split across two files mid-processing, so I snipped from after the qtfaststart items and merged, hopefully I've captured it all. BTW this is just a small random file I'm grabbing to test, I'm deleting and re-downloading the same one each time.

2021-02-21 19:54:53 - resources.mediaprocessor - DEBUG - Final output file: /movies/The Little Things (2021)/The Little Things (2021) [WEBRip-720p][8bit][h264][AAC 2.0]-EVO.mp4.
2021-02-21 19:54:53 - RadarrPostProcess - DEBUG - Radarr host: 127.0.0.1.
2021-02-21 19:54:53 - RadarrPostProcess - DEBUG - Radarr port: 7878.
2021-02-21 19:54:53 - RadarrPostProcess - DEBUG - Radarr webroot: .
2021-02-21 19:54:53 - RadarrPostProcess - DEBUG - Radarr apikey: a764dec478d2455fa3762893516b3e66.
2021-02-21 19:54:53 - RadarrPostProcess - DEBUG - Radarr protocol: http://.
2021-02-21 19:54:54 - RadarrPostProcess - DEBUG - {'name': 'RescanMovie', 'movieId': '184'}
2021-02-21 19:54:54 - RadarrPostProcess - DEBUG - {'message': 'The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.movieId | LineNumber: 0 | BytePositionInLine: 40.', 'description': "System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable`1[System.Int32]. Path: $.movieId | LineNumber: 0 | BytePositionInLine: 40.\n ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number.\n   at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& value)\n   at System.Text.Json.Utf8JsonReader.GetInt32()\n   at System.Text.Json.Serialization.Converters.NullableConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)\n   at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)\n   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n   --- End of inner exception stack trace ---\n   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)\n   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n   at System.Text.Json.Serialization.JsonConverter`1.ReadCoreAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan`1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)\n   at System.Text.Json.JsonSerializer.ReadAsync[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options, CancellationToken cancellationToken)\n   at NzbDrone.Common.Serializer.STJson.Deserialize(Stream input, Type type) in D:\\a\\1\\s\\src\\NzbDrone.Common\\Serializer\\System.Text.Json\\STJson.cs:line 50\n   at Radarr.Http.Extensions.ReqResExtensions.FromJson(Stream body, Type type) in D:\\a\\1\\s\\src\\Radarr.Http\\Extensions\\ReqResExtensions.cs:line 31\n   at NzbDrone.Api.Commands.CommandModule.StartCommand(CommandResource commandResource) in D:\\a\\1\\s\\src\\NzbDrone.Api\\Commands\\CommandModule.cs:line 56\n   at Radarr.Http.REST.RestModule`1.<set_CreateResource>b__43_0(Object options) in D:\\a\\1\\s\\src\\Radarr.Http\\REST\\RestModule.cs:line 206\n   at Nancy.NancyModule.<>c__DisplayClass38_0`1.<Post>b__0(Object args)\n   at Nancy.NancyModule.<>c__DisplayClass40_0`1.<Post>b__0(Object args, CancellationToken ct)\n   at Nancy.Routing.Route`1.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken)\n   at Nancy.Routing.DefaultRouteInvoker.Invoke(Route route, CancellationToken cancellationToken, DynamicDictionary parameters, NancyContext context)\n   at Nancy.Routing.DefaultRequestDispatcher.Dispatch(NancyContext context, CancellationToken cancellationToken)\n   at Nancy.NancyEngine.InvokeRequestLifeCycle(NancyContext context, CancellationToken cancellationToken, IPipelines pipelines)"}
2021-02-21 19:54:54 - RadarrPostProcess - ERROR - Radarr monitor status update failed.
Traceback (most recent call last):
  File "/usr/local/sma/postRadarr.py", line 168, in <module>
    if rescanAndWait(host, port, webroot, apikey, protocol, movieid, log):
  File "/usr/local/sma/postRadarr.py", line 26, in rescanAndWait
    log.info("Radarr response Rescan command: ID %d %s." % (rstate['id'], rstate['state']))
KeyError: 'id'

I've just noticed that they've pushed an updated image, but the only update would appear to be https://github.com/Radarr/Radarr/commit/3f5ff23210c74a60879218794173860f55c45e87 More changed on the 14th, errors seem to appear in my logs on the 13th, but that could be a timezone thing... https://github.com/Radarr/Radarr/commits/develop

mdhiggins commented 3 years ago

That was actually quite helpful

See if this fixes it 58e0ba7f84bb2cb32389a4f10183f36088bedb69

Looks like the movieID was getting passed as a string instead of an int, wondering if previously they had accepted this but now they don't, this should convert it to an int

preacher65 commented 3 years ago

Yes, that works perfectly now. Thanks!