Skip to content

Cannot create v2 backups: NullPointerException in requireNonNullBlob() #14875

Description

@tbvdm

Guidelines

  • I have searched open and closed issues for duplicates
  • I am submitting a bug report for existing functionality that does not work as intended
  • This isn't a feature request or a discussion topic

Bug description

On an old phone, after upgrading to v2 backups, Signal is no longer able to create backups. It used to be able to create "v1" backups (.backup files) without problems.

This is the relevant part of the debug log (I'm not at liberty to share the full debug log, but more information can be provided on request):

[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.signal.core.util.CursorExtensionsKt.requireNonNullBlob(CursorExtensions.kt:62)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.database.AttachmentTable.getLocalArchivableAttachments(AttachmentTable.kt:628)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.backup.v2.BackupRepository.$r8$lambda$-JkYeh5kBb-_Hj7tMEfN6Eqopns(BackupRepository.kt:789)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.backup.v2.BackupRepository$$ExternalSyntheticLambda36.invoke(R8$$SyntheticClass:0)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.backup.v2.BackupRepository.export(BackupRepository.kt:1101)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.backup.v2.BackupRepository.exportForLocalBackup(BackupRepository.kt:777)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.backup.v2.local.LocalArchiver.export(LocalArchiver.kt:84)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.jobs.LocalArchiveJob.run(LocalArchiveJob.kt:102)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.jobmanager.JobRunner.run(JobRunner.java:99)
[8.17.4] [4242 ] 2026-07-06 16:13:46.593 GMT+02:00 W LocalArchiveJob:   at org.thoughtcrime.securesms.jobmanager.JobRunner.run(JobRunner.java:62)

This is the relevant part of AttachmentTable.kt:

    617   fun getLocalArchivableAttachments(): List<LocalArchivableAttachment> {
    618     return readableDatabase
    619       .select(*PROJECTION_WITH_METADATA)
    620       .from(TABLE_NAME_WITH_METADTA)
    621       .where("$DATA_HASH_END IS NOT NULL AND $DATA_FILE IS NOT NULL AND ${AttachmentMetadataTable.TABLE_NAME}.${AttachmentMetadataTable.LOCAL_BACKUP_KEY} IS NOT NULL")
    622       .orderBy("$TABLE_NAME.$ID DESC")
    623       .run()
    624       .readToList {
    625         LocalArchivableAttachment(
    626           attachmentId = AttachmentId(it.requireLong(ID)),
    627           file = File(it.requireNonNullString(DATA_FILE)),
    628           random = it.requireNonNullBlob(DATA_RANDOM),
    629           size = it.requireLong(DATA_SIZE),
    630           localBackupKey = AttachmentMetadataTable.getMetadata(it)!!.localBackupKey!!,
    631           plaintextHash = Base64.decode(it.requireNonNullString(DATA_HASH_END)),
    632           contentType = it.requireString(CONTENT_TYPE)
    633         )
    634       }
    635   }

The phone contains old attachments that are encrypted with ClassicDecryptingPartInputStream. For these attachments, the DATA_RANDOM column is NULL. I expect this is the problem.

Would it be possible to fix this one way or the other so that Signal on this phone can create backups again?

Thanks.

Screenshots

No response

Device

No response

Android version

No response

Signal version

No response

Link to debug log

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions