libre-tube / LibreTube

An alternative frontend for YouTube, for Android.
https://libretube.dev
GNU General Public License v3.0
8.76k stars 445 forks source link

Can't import backup #6163

Closed ChaRob8747 closed 3 months ago

ChaRob8747 commented 5 months ago

Steps to reproduce

  1. Create a backup
  2. Pull it to computer (mac) with adb
  3. Factory-reset device (Google Pixel 4a)
  4. Push it to device with adb
  5. Reinstall LibreTube
  6. Load backup
  7. Error!

Expected behavior

LibreTube should be in the same state it was before I factory reset my smartphone.

Actual behavior

First time, it crashed. Subsequent tries, it gave me an error message I'll try to attach in a reply here.

LibreTube version

0.23.2

Android version

Android 14

Other details

I switched from LineageOS to crdroid. Also, I can't attach the backup file itself outa fear it contains private information.

Acknowledgements

ChaRob8747 commented 5 months ago

kotlinx.serialization.json.internal.JsonDecodingException: Expected end of the object '}', but had 'EOF' instead at path: $.watchPositions[380] JSON input: },{"videoId":"y9Jds326gks","..... at kotlinx.serialization.json.internal.WriteModeKt.JsonDecodingException(SourceFile:1) at kotlinx.serialization.json.internal.WriteModeKt.JsonDecodingException(SourceFile:2) at kotlinx.serialization.json.internal.AbstractJsonLexer.fail(SourceFile:52) at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$default(SourceFile:13) at kotlinx.serialization.json.internal.AbstractJsonLexer.fail$kotlinx_serialization_json(SourceFile:73) at kotlinx.serialization.json.internal.AbstractJsonLexer.unexpectedToken(SourceFile:48) at kotlinx.serialization.json.internal.AbstractJsonLexer.consumeNextToken(SourceFile:11) at kotlinx.serialization.json.internal.StreamingJsonDecoder.endStructure(SourceFile:53) at com.github.libretube.db.obj.WatchPosition$$serializer.deserialize(SourceFile:54) at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue$1(SourceFile:92) at kotlin.ResultKt.decodeSerializableElement(SourceFile:11) at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(SourceFile:46) at kotlinx.serialization.internal.CollectionLikeSerializer.readElement(SourceFile:8) at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(SourceFile:35) at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(SourceFile:6) at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue$1(SourceFile:92) at kotlin.ResultKt.decodeNullableSerializableElement(SourceFile:30) at com.github.libretube.obj.BackupFile$$serializer.deserialize(SourceFile:1) at com.github.libretube.obj.BackupFile$$serializer.deserialize(SourceFile:2) at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue$1(SourceFile:92) at okio.Utf8.decodeByReader(SourceFile:26) at kotlin.math.MathKt.decodeFromStream(SourceFile:17) at com.github.libretube.helpers.BackupHelper.restoreAdvancedBackup(SourceFile:196) at com.github.libretube.ui.preferences.BackupRestoreSettings$getBackupFile$1$1.invokeSuspend(SourceFile:49) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:9) at kotlinx.coroutines.DispatchedTask.run(SourceFile:115) at androidx.work.impl.WorkerWrapper$1.run(SourceFile:76) at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:92) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@9db29a, Dispatchers.IO]

Bnyro commented 3 months ago

It seems like the JSON file you're trying to import isn't actually valid. Can you please paste it into a json validator somewhere?

alejandro-alzate commented 3 months ago

I had that issue, sucks that i nuked mine. I would sended mine otherwise. my steps were all the same but without the adb and format bits. now my best guess is that that old beef between microsoft and unix systems about the newline thing \n & \r\n because when i move a repo folder between windows and linux, when i'm on linux git complains about the newline thing. But i have no proof for that, and also my backup never left my phone which on my case makes it weirder that happened to me.

ChaRob8747 commented 3 months ago

It seems like the JSON file you're trying to import isn't actually valid. Can you please paste it into a json validator somewhere?

It is invalid