beemdevelopment/Aegis · error · VaultRepositoryException

getBackupsLocation returned null

Error message

getBackupsLocation returned null

What it means

Guard in VaultBackupManager.createBackup: thrown as VaultRepositoryException when the configured backups location URI is null, meaning built-in backups were never given a destination (the user never enabled/selected a backup folder). scheduleBackup propagates the failure by storing the error in Preferences.BackupResult so the UI can surface a failed-backup state.

Solutions

  1. Treat a null backups location as a configuration error: skip the backup and record a failed BackupResult prompting the user to set a location
  2. Check Preferences.getBackupsLocation() for null before scheduling the backup task instead of failing inside createBackup
  3. Guard in scheduleBackup by verifying the backup Uri is configured, and surface a notification that no backup location is set
  4. Re-prompt the user via the backup settings screen to re-select a SAF location if the stored Uri is null
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/main/java/com/beemdevelopment/aegis/vault/VaultBackupManager.java:73 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08). Data as JSON: /api/errors/8209ab392dd7821b. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/com/beemdevelopment/aegis/vault/VaultBackupManager.java:73

    }

    public void scheduleBackup(File tempFile, BackupsVersioningStrategy strategy, Uri uri, int versionsToKeep) {
        _executor.execute(() -> {
            try {
                createBackup(tempFile, strategy, uri, versionsToKeep);
                _auditLogRepository.addBackupCreatedEvent();
                _prefs.setBuiltInBackupResult(new Preferences.BackupResult(null));
            } catch (VaultRepositoryException | VaultBackupPermissionException e) {
                e.printStackTrace();
                _prefs.setBuiltInBackupResult(new Preferences.BackupResult(e));
            }
        });
    }

    private void createBackup(File tempFile, BackupsVersioningStrategy strategy, Uri uri, int versionsToKeep)
            throws VaultRepositoryException, VaultBackupPermissionException {
        if (uri == null) {
            throw new VaultRepositoryException("getBackupsLocation returned null");
        }
        if (strategy == BackupsVersioningStrategy.SINGLE_BACKUP) {
            createBackup(tempFile, uri);
        } else if (strategy == BackupsVersioningStrategy.MULTIPLE_BACKUPS) {
            createBackup(tempFile, uri, versionsToKeep);
        } else {
            throw new VaultRepositoryException("Invalid backups versioning strategy");
        }
    }

    private void createBackup(File tempFile, Uri fileUri)
            throws VaultRepositoryException, VaultBackupPermissionException {
        Log.i(TAG, String.format("Creating backup at %s", fileUri));
        try {
            if (!hasPermissionsAt(fileUri)) {
                throw new VaultBackupPermissionException("No persisted URI permissions");
            }
            ContentResolver resolver = _context.getContentResolver();

View on GitHub (pinned to d6f4e5925a)