{"record":{"id":"8209ab392dd7821b","repo":"beemdevelopment/Aegis","slug":"getbackupslocation-returned-null","errorCode":null,"errorMessage":"getBackupsLocation returned null","messagePattern":"getBackupsLocation returned null","errorType":"exception","errorClass":"VaultRepositoryException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/vault/VaultBackupManager.java","lineNumber":73,"sourceCode":"    }\n\n    public void scheduleBackup(File tempFile, BackupsVersioningStrategy strategy, Uri uri, int versionsToKeep) {\n        _executor.execute(() -> {\n            try {\n                createBackup(tempFile, strategy, uri, versionsToKeep);\n                _auditLogRepository.addBackupCreatedEvent();\n                _prefs.setBuiltInBackupResult(new Preferences.BackupResult(null));\n            } catch (VaultRepositoryException | VaultBackupPermissionException e) {\n                e.printStackTrace();\n                _prefs.setBuiltInBackupResult(new Preferences.BackupResult(e));\n            }\n        });\n    }\n\n    private void createBackup(File tempFile, BackupsVersioningStrategy strategy, Uri uri, int versionsToKeep)\n            throws VaultRepositoryException, VaultBackupPermissionException {\n        if (uri == null) {\n            throw new VaultRepositoryException(\"getBackupsLocation returned null\");\n        }\n        if (strategy == BackupsVersioningStrategy.SINGLE_BACKUP) {\n            createBackup(tempFile, uri);\n        } else if (strategy == BackupsVersioningStrategy.MULTIPLE_BACKUPS) {\n            createBackup(tempFile, uri, versionsToKeep);\n        } else {\n            throw new VaultRepositoryException(\"Invalid backups versioning strategy\");\n        }\n    }\n\n    private void createBackup(File tempFile, Uri fileUri)\n            throws VaultRepositoryException, VaultBackupPermissionException {\n        Log.i(TAG, String.format(\"Creating backup at %s\", fileUri));\n        try {\n            if (!hasPermissionsAt(fileUri)) {\n                throw new VaultBackupPermissionException(\"No persisted URI permissions\");\n            }\n            ContentResolver resolver = _context.getContentResolver();","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/vault/VaultBackupManager.java#L55-L91","documentation":"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.","triggerScenarios":"Thrown at app/src/main/java/com/beemdevelopment/aegis/vault/VaultBackupManager.java:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat a null backups location as a configuration error: skip the backup and record a failed BackupResult prompting the user to set a location","Check Preferences.getBackupsLocation() for null before scheduling the backup task instead of failing inside createBackup","Guard in scheduleBackup by verifying the backup Uri is configured, and surface a notification that no backup location is set","Re-prompt the user via the backup settings screen to re-select a SAF location if the stored Uri is null"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}