pxb1988/dex2jar · error · DexException
while accept parameter annotation in method
Error message
while accept parameter annotation in method:%s.
What it means
DexException wrapping any failure that occurs while DexFileReader.accept(DexMethodVisitor) reads and dispatches a method's parameter annotations from the dex file's parameter-annotation table. The original cause is preserved as the exception cause; the message identifies which method's annotations failed to decode.
Solutions
- Inspect the wrapped cause (e.getCause()) to find the underlying decode failure
- Verify the dex file with dexdump/dexlint to confirm the annotation section is intact
- Rebuild the dex/apk with the standard dx/d8 toolchain before converting
- If the dex is known-bad, skip parameter annotations via config options or catch DexException around accept()
Example fix
// before
reader.accept(dmv);
// after
try {
reader.accept(dmv);
} catch (DexException e) {
log.warn("bad parameter annotations for dex", e.getCause());
} Defensive patterns
Strategy: try-catch
Validate before calling
// Validate dex before conversion DexFileReader r = new DexFileReader(dexBytes); // optionally run dexdump -d classes.dex externally and fail on errors
Try / catch
try {
reader.accept(dmv);
} catch (DexException e) {
logger.warn("parameter annotations unreadable", e.getCause());
} Prevention
- Use dexes built by dx/d8, not hand-patched ones
- Verify dex integrity (checksum/signature) before parsing
- Keep d2j updated
When it happens
Trigger: Calling accept() on a DexFileReader whose dex file has a corrupt or truncated parameter_annotations entry, or an annotation set ref list offset that points outside the file, causing read_annotation_set_ref_list to throw.
Common situations: Processing a dex file produced by a non-standard toolchain, an obfuscator or packer that rewrites annotation offsets, or a truncated/corrupted classes.dex inside an APK.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- While accepting parameter annotation in parameter
- Encountered RESTART_LOCAL on new v
- while accept code in method
- while accept method:[ ]
- jump out of insns -> %04x
AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08).
Data as JSON: /api/errors/a5d821d34d240e2b.
Report an issue: GitHub.
Appendix: source
Thrown at dex-reader/src/main/java/com/googlecode/d2j/reader/DexFileReader.java:1050
try {
DexMethodVisitor dmv = cv.visitMethod(method_access_flags, method);
if (dmv != null) {
if ((config & SKIP_ANNOTATION) == 0) {
Integer annotation_offset = methodAnnos.get(method_id);
if (annotation_offset != null) {
try {
read_annotation_set_item(annotation_offset, dmv);
} catch (Exception e) {
throw new DexException(e, "while accept annotation in method:%s.", method.toString());
}
}
Integer parameter_annotation_offset = parameterAnnos.get(method_id);
if (parameter_annotation_offset != null) {
try {
read_annotation_set_ref_list(parameter_annotation_offset, dmv);
} catch (Exception e) {
throw new DexException(e, "while accept parameter annotation in method:%s.",
method.toString());
}
}
}
if (code_off != 0) {
boolean keep = true;
if (0 != (SKIP_CODE & config)) {
keep = 0 != (KEEP_CLINIT & config) && method.getName().equals("<clinit>");
}
if(keep) {
DexCodeVisitor dcv = dmv.visitCode();
if (dcv != null) {
try {
acceptCode(code_off, dcv, config, (method_access_flags & DexConstants.ACC_STATIC) != 0,
method);
} catch (Exception e) {
throw new DexException(e, "while accept code in method:[%s] @%08x", method.toString(),
code_off);
View on GitHub (pinned to b5bda4fb49)