Aegis icon indicating copy to clipboard operation
Aegis copied to clipboard

[BUG] Nextcloud Backup stops working with createFile returned null

Open Bruceforce opened this issue 1 year ago • 13 comments

Version

3.1

Source

Google Play

Vault encryption

Yes (with biometric unlock)

Device

Poco F2 Pro

Android version

12

ROM

No response

Steps to reproduce

  1. Enable Auto Backup.
  2. Configure a Nextcloud folder as target for the backups.
  3. Don't change anything for some time (sorry it's unclear to me what exactly triggers this)

What do you expect to happen?

Nextcloud backups should continue to work also if there was no backup in a few weeks.

What happens instead?

Nextcloud backups stop working after some time. I get an error com.beemdevelopment.aegis.vault.VaultManagerException: createFile returned null" if I click on Details.

Log

No response

Bruceforce avatar Jul 14 '24 16:07 Bruceforce

This is likely to be an issue at Nextcloud's end. It can't hurt to take a look at the logs to see if there's anything that points us in the right direction though.

Please capture a log using ADB while reproducing the issue and share it with us: https://github.com/beemdevelopment/Aegis/blob/master/CONTRIBUTING.md#bug-reports. Just Aegis' logs won't suffice, so please exclude the log filter for Aegis.

alexbakker avatar Jul 14 '24 19:07 alexbakker

Will do. But it might take a time because I just "re-enabled" the backup granting access to the folder which usually fixes the issue for a couple of days. Once it comes back I'll capture some logs and post them here.

Bruceforce avatar Jul 14 '24 19:07 Bruceforce

Hey @alexbakker I grabbed the debug log. full-debug.log

Bruceforce avatar Aug 11 '24 10:08 Bruceforce

Thanks. Relevant portion from the log:

08-11 12:09:16.890 14674 18746 I VaultBackupManager: Creating backup at content://org.nextcloud.documents/tree/083520c769d3fadce4db0d5a8f4ba118/2312/document/083520c769d3fadce4db0d5a8f4ba118/2312: aegis-backup-20240811-120916.json
08-11 12:09:16.894 14674 18746 E ActivityThread: Failed to find provider info for org.nextcloud.documents
08-11 12:09:16.894 14674 18746 W DocumentFile: Failed query: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToNext()' on a null object reference
08-11 12:09:16.896 14674 18746 E ActivityThread: Failed to find provider info for org.nextcloud.documents
08-11 12:09:16.896 14674 18746 W DocumentsContract: Failed to create document
08-11 12:09:16.896 14674 18746 W DocumentsContract: java.lang.IllegalArgumentException: Unknown authority org.nextcloud.documents
08-11 12:09:16.896 14674 18746 W DocumentsContract: 	at android.content.ContentResolver.call(ContentResolver.java:2447)
08-11 12:09:16.896 14674 18746 W DocumentsContract: 	at android.provider.DocumentsContract.createDocument(DocumentsContract.java:1380)
08-11 12:09:16.896 14674 18746 W DocumentsContract: 	at androidx.documentfile.provider.TreeDocumentFile.createFile(SourceFile:23)
08-11 12:09:16.896 14674 18746 W DocumentsContract: 	at com.beemdevelopment.aegis.vault.VaultBackupManager.createBackup(SourceFile:88)
08-11 12:09:16.896 14674 18746 W DocumentsContract: 	at com.beemdevelopment.aegis.vault.VaultBackupManager$$ExternalSyntheticLambda0.run(SourceFile:12)
08-11 12:09:16.896 14674 18746 W DocumentsContract: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
08-11 12:09:16.896 14674 18746 W DocumentsContract: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
08-11 12:09:16.896 14674 18746 W DocumentsContract: 	at java.lang.Thread.run(Thread.java:1012)
08-11 12:09:16.896 14674 18746 E VaultBackupManager: Unable to create backup: com.beemdevelopment.aegis.vault.VaultRepositoryException: createFile returned null
08-11 12:09:16.897 14674 18746 W System.err: com.beemdevelopment.aegis.vault.VaultRepositoryException: createFile returned null
08-11 12:09:16.897 14674 18746 W System.err: 	at com.beemdevelopment.aegis.vault.VaultBackupManager.createBackup(SourceFile:346)
08-11 12:09:16.897 14674 18746 W System.err: 	at com.beemdevelopment.aegis.vault.VaultBackupManager$$ExternalSyntheticLambda0.run(SourceFile:12)
08-11 12:09:16.897 14674 18746 W System.err: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
08-11 12:09:16.897 14674 18746 W System.err: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
08-11 12:09:16.897 14674 18746 W System.err: 	at java.lang.Thread.run(Thread.java:1012)

In particular:

Failed to find provider info for org.nextcloud.documents

You do still have the Nextcloud app installed and are logged into it, right? And you didn't uninstall / reinstall Nextcloud in the mean time after you enabled automatic backups in Aegis?

alexbakker avatar Aug 21 '24 18:08 alexbakker

You do still have the Nextcloud app installed and are logged into it, right?

Correct. Nextcloud works like normal and I'm still logged in when receiving the error. Don't know if this matters, but Nextcloud is only accessible if I'm connected via VPN to my network, but the Aegis backup fails also when I'm home.

And you didn't uninstall / reinstall Nextcloud in the mean time after you enabled automatic backups in Aegis?

Nope. Nextcloud was installed all the time. As mentioned initially it fails after some amount of time, but this happens every few weeks. That's why I provided the log so late.

Bruceforce avatar Aug 21 '24 18:08 Bruceforce

I'm not sure what could be going on here. I would have to dig into how document providers are managed by Android and what might cause Android to forget about one. Either way, I don't think there's anything we can do about it from Aegis' end.

alexbakker avatar Aug 27 '24 20:08 alexbakker

Hey there, I ran into the same error. For me it could be fixed by just re-defining the backup folder in the Aegis settings. Right after that, the backup worked again

moedn avatar Sep 26 '24 08:09 moedn

Hey there, I ran into the same error. For me it could be fixed by just re-defining the backup folder in the Aegis settings. Right after that, the backup worked again

Hey. Thanks for the suggested fix. However, this is not a fix (at least for me). It will break again and again and again... I re-add the backup every few weeks. Then it works for two weeks or so and then it stops working again.

Bruceforce avatar Sep 26 '24 08:09 Bruceforce

I had the same issue using a folder on device (not Nextcloud). See below. Manually creating this folder solved the issue (for now). Version 3.2 from F-Droid on GrapheneOS.

10-12 07:03:24.971 30415 30728 I VaultBackupManager: Creating backup at content://com.android.externalstorage.documents/tree/primary:Syncthing/T420/Backup/Aegis/document/primary:Syncthing/T420/Backup/Aegis: aegis-backup-20241012-090324.json
10-12 07:03:24.982 30415 30728 W DocumentFile: Failed query: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToNext()' on a null object reference
10-12 07:03:24.995 30415 30728 W DocumentsContract: Failed to create document
10-12 07:03:24.995 30415 30728 W DocumentsContract: android.os.ParcelableException: java.io.FileNotFoundException: Missing file for primary:Syncthing/T420/Backup/Aegis at /storage/emulated/0/Syncthing/T420/Backup/Aegis
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:82)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:79)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.os.Parcel.readParcelableInternal(Parcel.java:5036)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.os.Parcel.readParcelable(Parcel.java:5018)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3187)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.os.Parcel.createException(Parcel.java:3176)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.os.Parcel.readException(Parcel.java:3152)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:202)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:154)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.content.ContentProviderProxy.call(ContentProviderNative.java:764)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.content.ContentResolver.call(ContentResolver.java:2494)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.provider.DocumentsContract.createDocument(DocumentsContract.java:1380)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at androidx.cardview.widget.CardView$1.createFile(SourceFile:16)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at com.beemdevelopment.aegis.vault.VaultBackupManager.createBackup(SourceFile:98)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at com.beemdevelopment.aegis.vault.VaultBackupManager$$ExternalSyntheticLambda0.run(SourceFile:12)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at java.lang.Thread.run(Thread.java:1012)
10-12 07:03:24.995 30415 30728 W DocumentsContract: Caused by: java.io.FileNotFoundException: Missing file for primary:Syncthing/T420/Backup/Aegis at /storage/emulated/0/Syncthing/T420/Backup/Aegis
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at java.lang.reflect.Constructor.newInstance0(Native Method)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	at android.os.ParcelableException.readFromParcel(ParcelableException.java:56)
10-12 07:03:24.995 30415 30728 W DocumentsContract: 	... 18 more
10-12 07:03:24.995 30415 30728 E VaultBackupManager: Unable to create backup: com.beemdevelopment.aegis.vault.VaultRepositoryException: createFile returned null
10-12 07:03:24.995 30415 30728 W System.err: com.beemdevelopment.aegis.vault.VaultRepositoryException: createFile returned null
10-12 07:03:24.995 30415 30728 W System.err: 	at com.beemdevelopment.aegis.vault.VaultBackupManager.createBackup(SourceFile:383)
10-12 07:03:24.995 30415 30728 W System.err: 	at com.beemdevelopment.aegis.vault.VaultBackupManager$$ExternalSyntheticLambda0.run(SourceFile:12)
10-12 07:03:24.995 30415 30728 W System.err: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
10-12 07:03:24.995 30415 30728 W System.err: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
10-12 07:03:24.995 30415 30728 W System.err: 	at java.lang.Thread.run(Thread.java:1012)

jonfre avatar Oct 12 '24 08:10 jonfre

Would be interesting to know if the issue re-appears on your end also after a few weeks.

Bruceforce avatar Oct 12 '24 12:10 Bruceforce

Hi, same problem, detected a few hours ago.

In my case, creating a new folder and re-defining it in the Aegis settings don't fix the issue.

Nextcloud Android 3.30.6 and Aegis 3.3.3

elraro avatar Jan 06 '25 20:01 elraro

Same problem for me. Relevant logs:

02-25 19:59:33.209  3429  3447 D DocumentsStorageProvider: createDocument(), id=533513ca80a78b744a3495ef139c6050/6
02-25 19:59:33.213  3429  3447 E DatabaseUtils: Writing exception to parcel
02-25 19:59:33.213  3429  3447 E DatabaseUtils: android.os.ParcelableException: java.io.FileNotFoundException: Temp folder could not be created: /null/nextcloud/tmp/[email protected]
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at android.provider.DocumentsProvider.call(DocumentsProvider.java:1093)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at android.content.ContentProvider.call(ContentProvider.java:2737)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at android.content.ContentProvider$Transport.call(ContentProvider.java:639)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:307)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at android.os.Binder.execTransactInternal(Binder.java:1436)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at android.os.Binder.execTransact(Binder.java:1375)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: Caused by: java.io.FileNotFoundException: Temp folder could not be created: /null/nextcloud/tmp/[email protected]
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at com.owncloud.android.providers.DocumentsStorageProvider.createFile(DocumentsStorageProvider.java:569)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at com.owncloud.android.providers.DocumentsStorageProvider.createDocument(DocumentsStorageProvider.java:522)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at android.provider.DocumentsProvider.callUnchecked(DocumentsProvider.java:1152)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	at android.provider.DocumentsProvider.call(DocumentsProvider.java:1091)
02-25 19:59:33.213  3429  3447 E DatabaseUtils: 	... 5 more
02-25 19:59:33.215  3354  3427 W DocumentsContract: Failed to create document
02-25 19:59:33.215  3354  3427 W DocumentsContract: android.os.ParcelableException: java.io.FileNotFoundException: Temp folder could not be created: /null/nextcloud/tmp/[email protected]
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:82)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.os.ParcelableException$1.createFromParcel(ParcelableException.java:79)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.os.Parcel.readParcelableInternal(Parcel.java:5084)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.os.Parcel.readParcelable(Parcel.java:5066)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.os.Parcel.createExceptionOrNull(Parcel.java:3235)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.os.Parcel.createException(Parcel.java:3224)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.os.Parcel.readException(Parcel.java:3200)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:203)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:155)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.content.ContentProviderProxy.call(ContentProviderNative.java:764)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.content.ContentResolver.call(ContentResolver.java:2494)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.provider.DocumentsContract.createDocument(DocumentsContract.java:1380)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at androidx.cardview.widget.CardView$1.createFile(SourceFile:16)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at com.beemdevelopment.aegis.vault.VaultBackupManager.createBackup(SourceFile:98)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at com.beemdevelopment.aegis.vault.VaultBackupManager$$ExternalSyntheticLambda0.run(SourceFile:12)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at java.lang.Thread.run(Thread.java:1117)
02-25 19:59:33.215  3354  3427 W DocumentsContract: Caused by: java.io.FileNotFoundException: Temp folder could not be created: /null/nextcloud/tmp/[email protected]
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at java.lang.reflect.Constructor.newInstance0(Native Method)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	at android.os.ParcelableException.readFromParcel(ParcelableException.java:56)
02-25 19:59:33.215  3354  3427 W DocumentsContract: 	... 18 more
02-25 19:59:33.215  3354  3427 E VaultBackupManager: Unable to create backup: com.beemdevelopment.aegis.vault.VaultRepositoryException: createFile returned null
02-25 19:59:33.216  3354  3427 W System.err: com.beemdevelopment.aegis.vault.VaultRepositoryException: createFile returned null
02-25 19:59:33.216  3354  3427 W System.err: 	at com.beemdevelopment.aegis.vault.VaultBackupManager.createBackup(SourceFile:383)
02-25 19:59:33.216  3354  3427 W System.err: 	at com.beemdevelopment.aegis.vault.VaultBackupManager$$ExternalSyntheticLambda0.run(SourceFile:12)
02-25 19:59:33.216  3354  3427 W System.err: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
02-25 19:59:33.216  3354  3427 W System.err: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
02-25 19:59:33.216  3354  3427 W System.err: 	at java.lang.Thread.run(Thread.java:1117)
02-25 19:59:33.219  3429  3460 D OwnCloudClient #0: REQUEST PROPFIND /remote.php/dav/files/itrooz/Apps/Nextcloud/

I was able to "fix" it by starting the Nextcloud app. If I then kill the Nextcloud app and re-trigger a backup, the same error re-appears.

iTrooz avatar Feb 25 '25 19:02 iTrooz

I had an "App Passcode" in the Nextcoud app. When I disabled the app passcode my backups started working again. (Opening the Nextcloud app was not enough).

erikman avatar Apr 14 '25 16:04 erikman