{"record":{"id":"ed3bb3fd1a8ea7d0","repo":"MuntashirAkon/AppManager","slug":"invalid-attribute-name-e","errorCode":null,"errorMessage":"Invalid attribute ${name}: ${e}","messagePattern":"Invalid attribute (.+?): (.+?)","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":742,"sourceCode":"                default:\n                    // Unknown data type; null is the best we can offer\n                    return null;\n            }\n        }\n\n        public @Nullable byte[] getValueBytesHex() throws XmlPullParserException {\n            switch (type) {\n                case TYPE_NULL:\n                    return null;\n                case TYPE_BYTES_HEX:\n                case TYPE_BYTES_BASE64:\n                    return valueBytes;\n                case TYPE_STRING:\n                case TYPE_STRING_INTERNED:\n                    try {\n                        return hexStringToBytes(valueString);\n                    } catch (Exception e) {\n                        throw new XmlPullParserException(\"Invalid attribute \" + name + \": \" + e);\n                    }\n                default:\n                    throw new XmlPullParserException(\"Invalid conversion from \" + type);\n            }\n        }\n\n        public @Nullable byte[] getValueBytesBase64() throws XmlPullParserException {\n            switch (type) {\n                case TYPE_NULL:\n                    return null;\n                case TYPE_BYTES_HEX:\n                case TYPE_BYTES_BASE64:\n                    return valueBytes;\n                case TYPE_STRING:\n                case TYPE_STRING_INTERNED:\n                    try {\n                        return Base64.decode(valueString, Base64.NO_WRAP);\n                    } catch (Exception e) {","sourceCodeStart":724,"sourceCodeEnd":760,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java#L724-L760","documentation":"An attribute whose stored type is TYPE_STRING (or TYPE_STRING_INTERNED) was expected to hold hex-encoded bytes, but hexStringToBytes(valueString) failed to decode it. The parser wraps the underlying decode exception in XmlPullParserException('Invalid attribute <name>: <cause>'), naming the offending attribute.","triggerScenarios":"Calling Attribute.getValueBytesHex() on a string-typed attribute whose value is not valid hex (odd length, non-hex characters, null/empty where bytes were required).","commonSituations":"Reading binary XML written by a different producer that stored plain strings where the consumer expects hex-encoded byte arrays; schema drift between writer and reader versions.","solutions":["Verify the attribute value is valid hex (even length, [0-9a-fA-F]) before calling getValueBytesHex()","Read the attribute as a string via getValueString() and decode it yourself with your own error handling","Check which component wrote the XML and whether it intends hex encoding for this attribute","Catch XmlPullParserException and fall back to a string read for resilient parsing"],"exampleFix":"// before\nbyte[] b = attr.getValueBytesHex();\n// after\nString v = attr.getValueString();\nbyte[] b = (v != null && v.length() % 2 == 0 && v.matches(\"[0-9a-fA-F]*\"))\n        ? hexToBytes(v) : null;","handlingStrategy":"validation","validationCode":"String v = attr.getValueString();\nboolean isHex = v != null && !v.isEmpty() && v.length() % 2 == 0 && v.chars().allMatch(c -> Character.digit(c, 16) != -1 || c == '-');\nif (!isHex) return null;","typeGuard":null,"tryCatchPattern":"try { return attr.getValueBytesHex(); } catch (XmlPullParserException e) { return attr.getValueString().getBytes(StandardCharsets.UTF_8); }","preventionTips":["Validate hex strings (even length, hex alphabet) before conversion","Confirm writer/reader agree on hex encoding for this attribute","Fall back to string reads when bytes are optional"],"tags":["xml","binary-xml","hex-decode","attribute"],"backgroundTag":"invalid-argument-format","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}