skylot/jadx · error · IndexOutOfBoundsException
Attempted to get instructions slice of block {} with {} skip
Error message
Attempted to get instructions slice of block {} with {} skipped instructions whilst only having {} instructions in block. What it means
Thrown as IndexOutOfBoundsException by TraverserBlockInfo.getInsnsSlice() when the sum of bottomOffset and topOffset exceeds the block's total instruction count. The block info tracks how many instructions to skip from the top (entry) and bottom (exit) of a block to produce the 'active' instruction window. If these offsets are inflated beyond the block's instruction list size, the slice computation is impossible.
Source
Thrown at jadx-core/src/main/java/jadx/core/dex/visitors/finaly/traverser/state/TraverserBlockInfo.java:79
}
public void setBottomOffset(int bottomOffset) {
this.bottomOffset = bottomOffset;
}
public int getBottomImplicitCount() {
return bottomImplicitCount;
}
public void setBottomImplicitOffset(int bottomImplicitCount) {
this.bottomImplicitCount = bottomImplicitCount;
}
public List<InsnNode> getInsnsSlice() {
List<InsnNode> insns = block.getInstructions();
int totalSkippedCount = bottomOffset + topOffset;
if (totalSkippedCount > insns.size()) {
throw new IndexOutOfBoundsException("Attempted to get instructions slice of block " + block.toString() + " with "
+ totalSkippedCount + " skipped instructions whilst only having " + insns.size() + " instructions in block.");
}
int startIndex = topOffset;
int endIndex = insns.size() - bottomOffset;
return insns.subList(startIndex, endIndex);
}
}
View on GitHub (pinned to e738a26571)
Solutions
- Report to jadx developers with the input and stack trace, noting the block and offset values in the message.
- Workaround: disable the finally extraction pass.
- If developing jadx, add a precondition check in setBottomOffset/setTopOffset that rejects values exceeding the block instruction count, and audit ImplicitInsnBlockTraverserVisitor and PathEndBlockTraverserVisitor for stale instruction-list assumptions.
Defensive patterns
Strategy: validation
Validate before calling
List<InsnNode> insns = block.getInstructions();
int totalSkipped = bottomOffset + topOffset;
if (totalSkipped > insns.size()) {
// Offsets exceed block size; clamp or reset before calling getInsnsSlice()
return Collections.emptyList();
} Prevention
- If developing jadx, validate offsets in setBottomOffset/setTopOffset against the current instruction count.
- Ensure instruction lists are not mutated after TraverserBlockInfo creation, or invalidate offsets on mutation.
- Report inputs that trigger this with the block and offset values from the error message.
When it happens
Trigger: bottomOffset or topOffset was set (via setBottomOffset/setTopOffset) to values whose sum exceeds block.getInstructions().size(). This occurs when a visitor computes offsets based on a stale or modified instruction list, or when implicit-instruction accounting (bottomImplicitCount) interacts incorrectly with explicit offsets.
Common situations: Decompiling bytecode where a block's instructions were mutated or removed by a prior visitor pass after the TraverserBlockInfo was created. Also possible with empty blocks or blocks reduced to zero instructions by dead-code elimination while offsets remain non-zero.
Related errors
- Expected to find block info within {}
- Orphaned traverser state
- Unknown global traverser state. Has a global state been dupl
- Orphaned traverser state
- Orphaned TraverserState node
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/9711aa824a1dc61b.
Report an issue: GitHub.