MuntashirAkon/AppManager · error · org.xmlpull.v1.XmlPullParserException
Not at START_TAG
Error message
Not at START_TAG
What it means
XmlPullParserException from isEmptyElementTag() when the parser's current token is not START_TAG. Emptiness is only meaningful on an open start tag; the method's default branch throws with the literal message "Not at START_TAG".
Source
Thrown at libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java:570
}
@Override
public String getPrefix() {
// Prefixes are not supported
return null;
}
@Override
public boolean isEmptyElementTag() throws XmlPullParserException {
switch (mCurrentToken) {
case START_TAG:
try {
return (peekNextExternalToken() == END_TAG);
} catch (IOException e) {
throw new XmlPullParserException(e.toString());
}
default:
throw new XmlPullParserException("Not at START_TAG");
}
}
@Override
public int getAttributeCount() {
return mAttributeCount;
}
@Override
public String getAttributeNamespace(int index) {
// Namespaces are unsupported
return NO_NAMESPACE;
}
@Override
public String getAttributeName(int index) {
return mAttributes[index].name;
}View on GitHub (pinned to 0152f468fc)
Solutions
- Check getEventType() == XmlPullParser.START_TAG before calling isEmptyElementTag()
- Ensure next()/nextToken() has advanced to the start tag you intend to inspect
- Restructure loops to test the event type before calling token-specific accessors
- Use require(START_TAG, null, name) which throws a more descriptive mismatch message
Example fix
// before
boolean empty = parser.isEmptyElementTag();
// after
if (parser.getEventType() == XmlPullParser.START_TAG) {
boolean empty = parser.isEmptyElementTag();
} else {
throw new IllegalStateException("isEmptyElementTag called while not at START_TAG");
} Defensive patterns
Strategy: validation
Validate before calling
if (parser.getEventType() != XmlPullParser.START_TAG) throw new IllegalStateException("isEmptyElementTag() requires START_TAG"); Try / catch
try { boolean empty = parser.isEmptyElementTag(); } catch (XmlPullParserException e) { boolean empty = false; // not at START_TAG } Prevention
- Check getEventType() before token-specific accessors
- Ensure next() has reached the start tag first
- Use require(START_TAG, ...) for clearer diagnostics
When it happens
Trigger: Calling isEmptyElementTag() while on TEXT, END_TAG, START_DOCUMENT, END_DOCUMENT, or any non-START_TAG token; calling it after next() already consumed the start tag; calling it twice in a row (state unchanged is fine, but after advancing it fails).
Common situations: Assuming the parser sits on START_TAG inside a generic token loop; forgetting isEmptyElementTag() does not advance and pairing it with next() incorrectly; checking emptiness of the document root before the first next().
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Not applicable for token ${mCurrentToken}
- ${getPositionDescription()}
- Namespaces are not supported
- Invalid attribute ${name}: ${e}
- Invalid conversion from ${type}
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/90a7853a05f88779.
Report an issue: GitHub.