beemdevelopment/Aegis · error · DatabaseImporterException
Key not found
Error message
Key not found: %s
What it means
The Battle.net authenticator importer parses an XML export and looks up entries named "Serial" and "Secret" (RestoreCode-adjacent keys). If no entry matching the expected secret key name is found, it throws DatabaseImporterException because the vault entry cannot be constructed without the shared secret.
Solutions
- Export the authenticator data again ensuring it includes the Secret/Serial fields
- Open the XML and confirm an entry with Name "Secret" exists
- If keys are named differently, edit the XML to the expected names (Serial, Secret)
- Use manual entry in Aegis with the serial + restore code if the XML cannot be fixed
Example fix
// before
if (secretValue == null) {
throw new DatabaseImporterException(String.format("Key not found: %s", secretKey));
}
// after
if (secretValue == null) {
throw new DatabaseImporterException(String.format(
"Key '%s' not found in XML; not a valid Battle.net authenticator export", secretKey));
} Defensive patterns
Strategy: validation
Validate before calling
// before import, scan the XML
boolean hasSecret = xmlText.contains("<Name>Secret</Name>");
if (!hasSecret) {
throw new IllegalArgumentException("XML lacks a Secret entry — wrong Battle.net export");
} Try / catch
try {
state = importer.read(stream);
} catch (DatabaseImporterException e) {
if (e.getMessage().startsWith("Key not found")) {
showUserError("Missing Secret key in Battle.net XML");
}
} Prevention
- Export from Battle.net's authenticator restore flow, not generic account data
- Inspect the XML for Serial/Secret entries first
- Avoid manual renaming of XML keys
When it happens
Trigger: Importing an XML file that does not contain the expected <entry><Name>Secret</Name>... structure — wrong file, different Battle.net export format, or renamed keys.
Common situations: User exports the wrong XML (e.g. plain account data rather than authenticator restore data); manual edit renamed the key; older/newer Battle.net export schema.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Invalid number of iterations for PBKDF
- Unexpectedly high number of iterations
- Accounts.txt
- Unable to decode stream to bitmap
- Unable to find pack.json in the root of the ZIP file
AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08).
Data as JSON: /api/errors/033f02dee45a4b5e.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/com/beemdevelopment/aegis/importers/BattleNetImporter.java:68
try {
XmlPullParser parser = Xml.newPullParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
parser.setInput(stream, null);
parser.nextTag();
String serial = "";
String secretValue = null;
for (PreferenceParser.XmlEntry entry : PreferenceParser.parse(parser)) {
if (entry.Name.equals(secretKey)) {
secretValue = entry.Value;
} else if (entry.Name.equals(serialKey)) {
serial = entry.Value;
}
}
if (secretValue == null) {
throw new DatabaseImporterException(String.format("Key not found: %s", secretKey));
}
return new BattleNetImporter.State(serial, secretValue);
} catch (XmlPullParserException | IOException e) {
throw new DatabaseImporterException(e);
}
}
public static class State extends DatabaseImporter.State {
private final String _serial;
private final String _secretValue;
public State(String serial, String secretValue) {
super(false);
_serial = serial;
_secretValue = secretValue;
}
View on GitHub (pinned to d6f4e5925a)