skylot/jadx · error · JadxOverflowException
Regions stack size limit reached
Error message
Regions stack size limit reached
What it means
Thrown by RegionStack.push once the region-nesting depth exceeds REGIONS_STACK_LIMIT (hard-coded 1000). RegionStack tracks the nesting of regions (loops, ifs, try/catch) during region making; exceeding 1000 levels indicates pathologically deep nesting that would otherwise overflow the JVM stack. Like 181 it is a JadxOverflowException meant to fail a single method gracefully.
Source
Thrown at jadx-core/src/main/java/jadx/core/dex/visitors/regions/maker/RegionStack.java:67
return "Region: " + region + ", exits: " + exits;
}
}
private final Deque<State> stack;
private State curState;
public RegionStack(MethodNode mth) {
if (DEBUG) {
LOG.debug("New RegionStack: {}", mth);
}
this.stack = new ArrayDeque<>();
this.curState = new State();
}
public void push(IRegion region) {
stack.push(curState);
if (stack.size() > REGIONS_STACK_LIMIT) {
throw new JadxOverflowException("Regions stack size limit reached");
}
curState = curState.copyWith(region);
if (DEBUG) {
LOG.debug("Stack push: {}: {}", size(), curState);
}
}
public void pop() {
curState = stack.pop();
if (DEBUG) {
LOG.debug("Stack pop: {}: {}", size(), curState);
}
}
/**
* Add boundary(exit) node for current stack frame
*
* @param exit boundary node, null will be ignoredView on GitHub (pinned to e738a26571)
Solutions
- Upgrade jadx; region nesting has been bounded and refactored over releases.
- Report the sample so the cap or the nesting logic can be revisited.
- Exclude the affected method/class and continue the batch.
- Catch JadxOverflowException around per-method decompilation when using jadx as a library.
Example fix
// before
JadxDecompiler d = new JadxArgs(); ... d.parseClass(...).decompile();
// after
try { cls.decompile(); }
catch (JadxOverflowException e) { LOG.warn("skip {}: {}", cls, e.getMessage()); } Defensive patterns
Strategy: try-catch
Try / catch
try {
cls.decompile();
} catch (JadxOverflowException e) {
if (e.getMessage().contains("Regions stack size limit")) {
cls.addError("region nesting too deep", e);
} else { throw e; }
} Prevention
- Use a larger JVM thread stack (-Xss) when embedding jadx against hardened inputs.
- Catch JadxOverflowException per method so one pathological method does not abort the batch.
- Report the sample; the 1000-deep cap is hard-coded and only revisited upstream.
When it happens
Trigger: Decompiling a method whose region structure nests more than 1000 levels deep, which happens when the block graph has an extremely long chain of nested scopes (loops inside loops, ifs inside try/catch) before the maker can flatten them.
Common situations: Obfuscated bytecode that inserts thousands of synthetic nested scopes, generated code, or recursive-descent generated state machines. Rare in normal app code; common against hardened/packed targets.
Related errors
- Regions count limit reached at block {}
- Bad name for type variable: {}
- Can't parse type: {}, unexpected: {}
- No inner type found: {}
- Unexpected inner type found: {}
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/319de2da4ebcc4bf.
Report an issue: GitHub.