MuntashirAkon/AppManager · critical · java.lang.IllegalStateException
No fallback file found for: ${statePersistFile}
Error message
No fallback file found for: ${statePersistFile} What it means
IllegalStateException thrown when the primary settings XML file failed to parse and the fallback file also cannot be opened for reading (FileNotFoundException/IOException/RemoteException on the fallback path). The state manager needs at least one readable copy of the state; with neither available it aborts rather than returning empty state, which would silently wipe settings.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/ssaid/SettingsStateV26.java:848
} catch (IOException | RemoteException fnfe) {
Log.w(LOG_TAG, "No settings state %s", mStatePersistFile);
logSettingsDirectoryInformation(mStatePersistFile);
addHistoricalOperationLocked(HISTORICAL_OPERATION_INITIALIZE, null);
return;
}
if (parseStateFromXmlStreamLocked(in)) {
return;
}
// Settings file exists but is corrupted. Retry with the fallback file
Path statePersistFallbackFile = Paths.get(mStatePersistFile.getFilePath() + FALLBACK_FILE_SUFFIX);
Log.i(LOG_TAG, "Failed parsing settings file: %s, retrying with fallback file: %s", mStatePersistFile,
statePersistFallbackFile);
try {
in = new AtomicExtendedFile(statePersistFallbackFile.getFile()).openRead();
} catch (IOException | RemoteException fnfe) {
final String message = "No fallback file found for: " + mStatePersistFile;
throw new IllegalStateException(message, fnfe);
}
if (parseStateFromXmlStreamLocked(in)) {
// Parsed state from fallback file. Restore original file with fallback file
try {
IoUtils.copy(statePersistFallbackFile, mStatePersistFile);
} catch (IOException ignored) {
// Failed to copy, but it's okay because we already parsed states from fallback file
}
} else {
final String message = "Failed parsing settings file: " + mStatePersistFile;
throw new IllegalStateException(message);
}
}
@GuardedBy("mLock")
private boolean parseStateFromXmlStreamLocked(InputStream in) {
try {
TypedXmlPullParser parser = Xml.resolvePullParser(in);View on GitHub (pinned to 0152f468fc)
Solutions
- Restore a valid settings_ssaid.xml from backup to the user system directory
- Check that both the primary and fallback files exist and are readable (root/adb shell ls -l) and fix permissions/context
- Catch IllegalStateException and rebuild the settings state from defaults rather than crashing
- Re-trigger state creation by letting the framework regenerate the file (e.g. clear the relevant package data / reboot)
Example fix
// before
in = new AtomicExtendedFile(statePersistFallbackFile.getFile()).openRead();
// after
File f = statePersistFallbackFile.getFile();
if (!f.exists() || !f.canRead()) {
Log.w(LOG_TAG, "Fallback missing; initializing empty state for " + mStatePersistFile);
return; // or initializeDefaultsLocked()
}
in = new AtomicExtendedFile(f).openRead(); Defensive patterns
Strategy: fallback
Validate before calling
File primary = mStatePersistFile.getFile();
File fallback = statePersistFallbackFile.getFile();
if (!primary.canRead() && !fallback.canRead()) {
Log.w(TAG, "No settings state available; initializing defaults");
} Try / catch
try {
state = loadSettingsState();
} catch (IllegalStateException e) {
Log.e(TAG, "No readable settings file or fallback", e);
state = initializeDefaultState();
} Prevention
- Maintain an external backup of settings_ssaid.xml before modifications
- Never delete both primary and fallback copies manually
- Perform atomic writes only through the provided AtomicExtendedFile APIs
- Check storage mount/permission state before touching /data/system files
When it happens
Trigger: Parsing mStatePersistFile fails, code retries with statePersistFallbackFile, and AtomicExtendedFile(fallback).openRead() throws — e.g. the fallback file does not exist, was deleted, or resides on storage that is unreadable (permissions/mount issues).
Common situations: Corrupted primary settings_ssaid.xml combined with a missing or wiped fallback after an interrupted first write; root-based modification deleting both files; encrypted-storage/SELinux contexts blocking read of /system/users/0 files.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Failed parsing settings file: ${statePersistFile}
- settings_ssaid.xml is inaccessible.
- Couldn't delete old file <inputFile>
- Could not delete <mBackupPath>
- Could not move <mTempBackupPath> to <mBackupPath>
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/4a29c8b65e9acd86.
Report an issue: GitHub.