MuntashirAkon/AppManager · error · IOException
relativeDir not set.
Error message
relativeDir not set.
What it means
Backup.getItem() must locate the directory (relative to the backup root) where a backup's files live. From backup format version 5 onwards, relativeDir is a mandatory field on the Backup entity — the code can no longer infer it as it did for v4 backups (getV4RelativeDir). If relativeDir is empty/null and version >= 5, the backup record is malformed, so it throws IOException instead of guessing a wrong path.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/db/entity/Backup.java:92
@ColumnInfo(name = "installer_app")
@Nullable
public String installer;
@ColumnInfo(name = "info_hash")
public String relativeDir;
public BackupFlags getFlags() {
return new BackupFlags(flags);
}
@NonNull
public BackupItems.BackupItem getItem() throws IOException {
String relativeDir;
if (TextUtils.isEmpty(this.relativeDir)) {
if (version >= 5) {
// In backup v5 onwards, relativeDir must be set
throw new IOException("relativeDir not set.");
}
// Relative directory needs to be inferred.
relativeDir = BackupUtils.getV4RelativeDir(userId, backupName, packageName);
} else relativeDir = this.relativeDir;
return BackupItems.findBackupItem(relativeDir);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Backup)) return false;
Backup backup = (Backup) o;
return packageName.equals(backup.packageName)
&& userId == backup.userId
&& backupName.equals(backup.backupName);
}
@OverrideView on GitHub (pinned to 0152f468fc)
Solutions
- Recreate the backup so the v5+ metadata is written with relativeDir populated
- Manually set relativeDir on the Backup entity (e.g. from the backup's actual folder name) before calling getItem()
- If the record actually came from v4, correct the version field to 4 so the v4 inference path (BackupUtils.getV4RelativeDir) is used
- Inspect the backup metadata JSON on disk and add the missing relativeDir value
Example fix
// before
backup.setItemRetrieval(); // getItem() throws: relativeDir empty, version=5
// after
if (TextUtils.isEmpty(backup.relativeDir) && backup.version >= 5) {
backup.relativeDir = findActualBackupDir(backup.backupName); // e.g. "app/org.example/app-0"
}
backup.getItem(); Defensive patterns
Strategy: validation
Validate before calling
if (backup == null || backup.version < 0) throw new IllegalArgumentException("Bad backup record");
if (backup.version >= 5 && TextUtils.isEmpty(backup.relativeDir)) {
// infer, repair, or refuse before calling getItem()
backup.relativeDir = BackupUtils.getV4RelativeDir(backup.userId, backup.backupName, backup.packageName);
} Type guard
boolean hasRelativeDir(Backup b) { return b != null && !TextUtils.isEmpty(b.relativeDir); } Try / catch
try {
BackupItems.BackupItem item = backup.getItem();
} catch (IOException e) {
Log.e(TAG, "Backup metadata missing relativeDir (v5+)", e);
promptBackupRepairOrDelete();
} Prevention
- Ensure backup creation code always writes relativeDir for v5+
- Validate backup metadata JSON after import/migration
- Keep version field consistent with which fields are populated
When it happens
Trigger: Calling getItem() (directly or via restore, deleteBackup, isDataDirectoryChanged) on a Backup entity whose relativeDir field is empty or null while version >= 5 — e.g. a v5+ backup created by a buggy/incomplete save path, a hand-edited backup metadata file, or a record deserialized from older JSON missing the new field.
Common situations: Restoring or deleting a backup created by a newer App Manager version but imported into metadata that lost the field; custom scripts regenerating backup JSON without relativeDir; schema migration between backup format versions.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Destination doesn't contain any backup.
- Couldn't delete old file <inputFile>
- Could not delete <mBackupPath>
- Could not move <mTempBackupPath> to <mBackupPath>
- Android System (android) cannot be backed up.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/d0d2d67f7adcf768.
Report an issue: GitHub.