Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] On Linux ARM getting JSON Exception with -list operation #7

Open
samhilluk opened this issue Dec 15, 2022 · 7 comments
Open

[BUG] On Linux ARM getting JSON Exception with -list operation #7

samhilluk opened this issue Dec 15, 2022 · 7 comments
Assignees
Labels
Reviewing Item is being reviewed

Comments

@samhilluk
Copy link

Describe the bug
Running on Linux ARM with -list action getting the following error:

Connecting to Ring services
Authenticating using refresh token from previous session
Retrieving all devices... Unhandled exception. System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable1[System.Int32]. Path: $.doorbots[0].battery_life | LineNumber: 0 | BytePositionInLine: 173. ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number. at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& ) at System.Text.Json.Utf8JsonReader.GetInt32() at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& , Type , JsonSerializerOptions ) at System.Text.Json.Serialization.Converters.NullableConverter1.Read(Utf8JsonReader& , Type , JsonSerializerOptions )
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object , ReadStack& , Utf8JsonReader& ) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , TCollection& )
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object , ReadStack& , Utf8JsonReader& )
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& ) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& , Utf8JsonReader& , Exception ) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 , JsonTypeInfo , Nullable1 )
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 , JsonTypeInfo )
at System.Text.Json.JsonSerializer.Deserialize[TValue](String , JsonSerializerOptions )
at KoenZomers.Ring.Api.Session.GetRingDevices()
at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
at KoenZomers.Ring.SnapshotDownload.Program.

(String[] args)
Aborted

Expected behavior
Error should be handled with error handling, also should output contents of JSON object if error occurs to allow for fixing of issue.

Versions (please complete the following information):

  • OS: Raspian
  • RingSnapshotDownload: Version 1.2.0.0
@samhilluk samhilluk added the Reviewing Item is being reviewed label Dec 15, 2022
@iamtakeo
Copy link

Also getting the following on win x64

Retrieving all devices... Unhandled exception. System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable1[System.Int32]. Path: $.doorbots[0].battery_life | LineNumber: 0 | BytePositionInLine: 173. ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number. at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& ) at System.Text.Json.Utf8JsonReader.GetInt32() at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& , Type , JsonSerializerOptions ) at System.Text.Json.Serialization.Converters.NullableConverter1.Read(Utf8JsonReader& , Type , JsonSerializerOptions )
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object , ReadStack& , Utf8JsonReader& ) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , TCollection& )
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object , ReadStack& , Utf8JsonReader& )
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& ) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& , Utf8JsonReader& , Exception ) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 , JsonTypeInfo , Nullable1 )
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 , JsonTypeInfo )
at System.Text.Json.JsonSerializer.Deserialize[TValue](String , JsonSerializerOptions )
at KoenZomers.Ring.Api.Session.GetRingDevices()
at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
at KoenZomers.Ring.SnapshotDownload.Program.

(String[] args)

@KoenZomers
Copy link
Owner

Bit late, but if you're still interested in this, can you try it again with the latest version and see if it works well now?

@iamtakeo
Copy link

iamtakeo commented Jul 5, 2023

Bit late, but if you're still interested in this, can you try it again with the latest version and see if it works well now?

Thanks for the update, on version 1.3

I'm getting the following;

PS C:\Users\Craig\Downloads\Ring> .\ring -list

Ring Snapshot Download Tool v1.3.0.0 by Koen Zomers

Using settings from C:\Users\Craig\Downloads\Ring\Settings.json
Connecting to Ring services
Authenticating using refresh token from previous session
Retrieving all devices... Unhandled exception. System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable1[System.Int64]. Path: $.stickup_cams[0].battery_life | LineNumber: 0 | BytePositionInLine: 10358. ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number. at System.Text.Json.Utf8JsonReader.TryGetInt64(Int64& value) at System.Text.Json.Utf8JsonReader.GetInt64() at System.Text.Json.Serialization.Converters.Int64Converter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at System.Text.Json.Serialization.Converters.NullableConverter1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.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.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at KoenZomers.Ring.Api.Session.GetRingDevices()
at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
at KoenZomers.Ring.SnapshotDownload.Program.

(String[] args)

GPT4 says;
It looks like the application encountered an exception while trying to parse the JSON response from the Ring API. The error message indicates that it was expecting to find a numeric value (a nullable int64, to be precise) at the path $.stickup_cams[0].battery_life in the JSON, but it found a string value instead.

Sorry I'm a novice at this. I tried loading up in visual basic, but I couldn't find the relevant part of the code.

@KoenZomers
Copy link
Owner

I ran some tests and I think I have found the reason why it fails. Still running some tests. Will include it in the next release.

@KoenZomers KoenZomers reopened this Sep 2, 2023
KoenZomers added a commit to KoenZomers/RingApi that referenced this issue Sep 2, 2023
@KoenZomers
Copy link
Owner

KoenZomers commented Sep 2, 2023

Give it a try with 2.0.0.0 and see if it works now for you.

@scholzmichael
Copy link

Had this Json exeption today with 1.3, when doing a list after adding a spotlight cam, used 2.1.0.0 just for list and it worked fine. Due to my issue with authentification see my thread I'm using 1.3 for receiving the jpgs.

@scholzmichael
Copy link

scholzmichael commented Mar 19, 2024

Ok, now getting json exception with all verions starting 1.3 through 2.1.0.0:

sing settings from /home/pi/Ring/New/Settings.json
Connecting to Ring services
Authenticating using refresh token from previous session
Unhandled exception. System.Text.Json.JsonException: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at KoenZomers.Ring.Api.Session.RefreshSession(String refreshToken)
at KoenZomers.Ring.Api.Session.GetSessionByRefreshToken(String refreshToken)
at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
at KoenZomers.Ring.SnapshotDownload.Program.

(String[] args)
Abgebrochen

Is there going to be another update? Seemed that all stopped working on March 8th in the morning...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reviewing Item is being reviewed
Projects
None yet
Development

No branches or pull requests

4 participants