skylot/jadx · error · JadxRuntimeException
Unknown visibility flags: {}
Error message
Unknown visibility flags: {} What it means
Thrown by AccessInfo.makeString (visibility-to-label path) when none of isPackagePrivate/isPublic/isPrivate/isProtected is true. This means the access flags have no recognised visibility combination at all - a state the type system considers impossible for valid JVM access flags.
Source
Thrown at jadx-core/src/main/java/jadx/core/dex/info/AccessInfo.java:263
code.append("/* synthetic */ ");
}
return code.toString();
}
public String visibilityName() {
if (isPackagePrivate()) {
return "package-private";
}
if (isPublic()) {
return "public";
}
if (isPrivate()) {
return "private";
}
if (isProtected()) {
return "protected";
}
throw new JadxRuntimeException("Unknown visibility flags: " + getVisibility());
}
public int rawValue() {
return accFlags;
}
@Override
public String toString() {
return "AccessInfo: " + type + " 0x" + Integer.toHexString(accFlags) + " (" + makeString(true) + ')';
}
}
View on GitHub (pinned to e738a26571)
Solutions
- Inspect getVisibility() (printed in the message) to see the actual mask.
- Normalise flags at AccessInfo construction so exactly one visibility bit is set.
- If using jadx as a library, pass well-formed access flags (from a real Class/Member) rather than hand-crafted masks.
- Treat as malformed input and report/fallback to 'package-private'.
Example fix
// before
if (isProtected()) { return "protected"; }
throw new JadxRuntimeException("Unknown visibility flags: " + getVisibility());
// after (fall back instead of aborting string rendering)
LOG.warn("Unknown visibility flags: 0x{}", Integer.toHexString(accFlags));
return "package-private"; Defensive patterns
Strategy: validation
Validate before calling
int vis = getVisibility();
if (Integer.bitCount(vis & (AccessFlags.PUBLIC | AccessFlags.PROTECTED | AccessFlags.PRIVATE)) == 0 && vis != 0) {
LOG.warn("Unrecognised visibility mask 0x{}", Integer.toHexString(vis));
} Type guard
static boolean hasKnownVisibility(AccessInfo ai) {
return ai.isPackagePrivate() || ai.isPublic() || ai.isPrivate() || ai.isProtected();
} Try / catch
String label;
try {
label = ai.visibilityString();
} catch (JadxRuntimeException e) {
label = "package-private"; // safe fallback
} Prevention
- Normalise access flags at construction so exactly one visibility predicate is true.
- Always pass well-formed access flags (from real Class/Member reflection) rather than hand-crafted masks.
- Use a safe fallback when stringifying unknown flags rather than aborting output.
When it happens
Trigger: AccessInfo built from access flags where the visibility bits are inconsistent with the four predicates (e.g. flags that are zero-but-not-detected-as-package-private, or a custom AccessInfo constructed without normalisation). It is the string-form counterpart of error 87's ordering failure.
Common situations: Corrupted/obfuscated access flags; an AccessInfo constructed directly with raw flags that skip normalisation; combination of flags that defeats all four predicates (rare, since PUBLIC=0x1 always satisfies isPublic).
Related errors
- Unexpected visibility flag:
- Unexpected registers count in {}
- Unknown type: {}, expected: {}
- Unexpected key in switch:
- Unexpected arg type in catch block:
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/2ea7f335bfda2c17.
Report an issue: GitHub.