{"record":{"id":"a720432573fb0470","repo":"MuntashirAkon/AppManager","slug":"could-not-get-external-data-backup","errorCode":null,"errorMessage":"Could not get external data backup.","messagePattern":"Could not get external data backup\\.","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java","lineNumber":312,"sourceCode":"        }\n    }\n\n    private void backupData() throws BackupException {\n        List<Path> dataFiles = new ArrayList<>(2);\n        if (mDestMetadata.info.flags.backupInternalData()) {\n            try {\n                dataFiles.add(mBackupLocation.findFile(CryptoUtils.getAppropriateFilename(mPackageName + \".zip\",\n                        mSourceCryptoMode)));\n            } catch (FileNotFoundException e) {\n                throw new BackupException(\"Could not get internal data backup.\", e);\n            }\n        }\n        if (mDestMetadata.info.flags.backupExternalData()) {\n            try {\n                dataFiles.add(mBackupLocation.findFile(EXTERNAL_FILES).findFile(CryptoUtils.getAppropriateFilename(\n                        mPackageName + \".zip\", mSourceCryptoMode)));\n            } catch (FileNotFoundException e) {\n                throw new BackupException(\"Could not get external data backup.\", e);\n            }\n        }\n        String tarType = mDestMetadata.info.tarType;\n        int i = 0;\n        Path[] files;\n        for (Path dataFile : dataFiles) {\n            files = new Path[]{dataFile};\n            // Decrypt APK file if needed\n            try {\n                files = ConvertUtils.decryptSourceFiles(files, mSourceCrypto, mSourceCryptoMode, mBackupItem);\n            } catch (IOException e) {\n                throw new BackupException(\"Failed to decrypt \" + Arrays.toString(files), e);\n            }\n            // baseApkFiles should be a singleton array\n            if (files.length != 1) {\n                throw new BackupException(\"Incorrect number of APK files: \" + files.length);\n            }\n            String dataBackupFilePrefix = BackupUtils.getDataFilePrefix(i++, getExt(tarType));","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java#L294-L330","documentation":"backupData() also collects the external data archive from the EXTERNAL_FILES subdirectory when the destination flags request external data backup. If that file cannot be found, the FileNotFoundException is wrapped into this BackupException: external-data backup was requested but the corresponding zip is absent from the external-files folder.","triggerScenarios":"backupData() executes mBackupLocation.findFile(EXTERNAL_FILES).findFile(CryptoUtils.getAppropriateFilename(mPackageName + \".zip\", mSourceCryptoMode)) and throws FileNotFoundException at OABConverter.java:312, with mDestMetadata.info.flags.backupExternalData() true.","commonSituations":"Source backup never included external data (app had none or OAndBackup backed up internal only); the external_files directory is missing or named differently; zip deleted during cleanup; crypto-mode mismatch producing a wrong expected filename.","solutions":["Place the external data zip inside the backup's external-files subdirectory (EXTERNAL_FILES) with the correct name.","Re-create the OAndBackup backup with external data included before converting.","If no external data exists, disable the external-data flag on the destination metadata so the lookup is skipped.","Verify the external-files directory name matches EXTERNAL_FILES exactly and the zip name/crypto transform matches mSourceCryptoMode."],"exampleFix":"// before: backup/external_files/ missing entirely while external data flag is set\n// after:\n//   backup/external_files/com.example.app.zip\n// or unset the external-data flag:\n// metadataV2.flags.removeFlag(BackupFlags.BACKUP_EXT_DATA);","handlingStrategy":"validation","validationCode":"String extZip = CryptoUtils.getAppropriateFilename(packageName + \".zip\", sourceCryptoMode);\nif (destFlags.backupExternalData()) {\n    if (!backupLocation.hasFile(EXTERNAL_FILES)\n            || !backupLocation.findFile(EXTERNAL_FILES).hasFile(extZip)) {\n        throw new IllegalStateException(\"External data zip missing: \" + EXTERNAL_FILES + \"/\" + extZip);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    converter.convert(...);\n} catch (BackupException e) {\n    if (e.getMessage().contains(\"external data backup\")) {\n        Log.e(TAG, \"external_files/<pkg>.zip not found; adjust flags or restore file\", e.getCause());\n    }\n}","preventionTips":["Verify the external-files subdirectory exists and is named exactly as EXTERNAL_FILES expects.","Only enable the external-data flag when the source backup actually contains external data.","Keep the external zip's crypto-transformed name in sync with the source crypto mode."],"tags":["android","backup","file-not-found","external-data"],"backgroundTag":"file-not-found","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}