{"record":{"id":"90a7853a05f88779","repo":"MuntashirAkon/AppManager","slug":"not-at-start-tag","errorCode":null,"errorMessage":"Not at START_TAG","messagePattern":"Not at START_TAG","errorType":"exception","errorClass":"org.xmlpull.v1.XmlPullParserException","httpStatus":null,"severity":"error","filePath":"libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java","lineNumber":570,"sourceCode":"    }\n\n    @Override\n    public String getPrefix() {\n        // Prefixes are not supported\n        return null;\n    }\n\n    @Override\n    public boolean isEmptyElementTag() throws XmlPullParserException {\n        switch (mCurrentToken) {\n            case START_TAG:\n                try {\n                    return (peekNextExternalToken() == END_TAG);\n                } catch (IOException e) {\n                    throw new XmlPullParserException(e.toString());\n                }\n            default:\n                throw new XmlPullParserException(\"Not at START_TAG\");\n        }\n    }\n\n    @Override\n    public int getAttributeCount() {\n        return mAttributeCount;\n    }\n\n    @Override\n    public String getAttributeNamespace(int index) {\n        // Namespaces are unsupported\n        return NO_NAMESPACE;\n    }\n\n    @Override\n    public String getAttributeName(int index) {\n        return mAttributes[index].name;\n    }","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java#L552-L588","documentation":"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\".","triggerScenarios":"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).","commonSituations":"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().","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"],"exampleFix":"// before\nboolean empty = parser.isEmptyElementTag();\n// after\nif (parser.getEventType() == XmlPullParser.START_TAG) {\n    boolean empty = parser.isEmptyElementTag();\n} else {\n    throw new IllegalStateException(\"isEmptyElementTag called while not at START_TAG\");\n}","handlingStrategy":"validation","validationCode":"if (parser.getEventType() != XmlPullParser.START_TAG) throw new IllegalStateException(\"isEmptyElementTag() requires START_TAG\");","typeGuard":null,"tryCatchPattern":"try { boolean empty = parser.isEmptyElementTag(); } catch (XmlPullParserException e) { boolean empty = false; // not at START_TAG }","preventionTips":["Check getEventType() before token-specific accessors","Ensure next() has reached the start tag first","Use require(START_TAG, ...) for clearer diagnostics"],"tags":["xml","parser","binary-xml","invalid-state"],"backgroundTag":"invalid-state-transition","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}