beemdevelopment/Aegis · error

Export list contains entries from different batches

Error message

Export list contains entries from different batches

What it means

Google Authenticator exports are batched; each Export carries a batchId and index. getMissingIndices requires all supplied exports to belong to one batch so missing indices can be computed; mixing entries from different transfers is ambiguous and raises IllegalArgumentException.

Solutions

  1. Pass only Export objects from a single transfer/batch; group them by getBatchId() first
  2. Restart the export/transfer to collect a complete single batch
  3. Split the list by batchId and call getMissingIndices per group

Example fix

// before
GoogleAuthInfo.Export.getMissingIndices(exportAandB); // mixed batches
// after
Map<Integer, List<Export>> byBatch = exports.stream().collect(groupingBy(Export::getBatchId));
byBatch.values().forEach(GoogleAuthInfo.Export::getMissingIndices);
Defensive patterns

Strategy: validation

Validate before calling

Set<Integer> batches = exports.stream().map(GoogleAuthInfo.Export::getBatchId).collect(toSet());
if (batches.size() > 1) throw new IllegalArgumentException("Mixed export batches");

Try / catch

try {
    List<Integer> missing = GoogleAuthInfo.Export.getMissingIndices(exports);
} catch (IllegalArgumentException e) {
    // group exports by batchId and process each batch separately
}

Prevention

When it happens

Trigger: Calling GoogleAuthInfo.Export.getMissingIndices with a list of Export objects whose getBatchId() values are not all identical (isSingleBatch returns false).

Common situations: Collecting partial exports across multiple separate transfer sessions and combining them, restoring exports from different devices, or a UI bug that mixes pending transfer batches.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java:362

        public List<GoogleAuthInfo> getEntries() {
            return _entries;
        }

        public int getBatchSize() {
            return _batchSize;
        }

        public int getBatchIndex() {
            return _batchIndex;
        }

        public int getBatchId() {
            return _batchId;
        }

        public static List<Integer> getMissingIndices(@NonNull List<Export> exports) throws IllegalArgumentException {
            if (!isSingleBatch(exports)) {
                throw new IllegalArgumentException("Export list contains entries from different batches");
            }

            List<Integer> indicesMissing = new ArrayList<>();
            if (exports.isEmpty()) {
                return indicesMissing;
            }

            Set<Integer> indicesPresent = exports.stream()
                    .map(Export::getBatchIndex)
                    .collect(Collectors.toSet());

            for (int i = 0; i < exports.get(0).getBatchSize(); i++) {
                if (!indicesPresent.contains(i)) {
                    indicesMissing.add(i);
                }
            }

            return indicesMissing;

View on GitHub (pinned to d6f4e5925a)