pxb1988/dex2jar · error · RuntimeException

can't find label for

Error message

can't find label for ${op} ${label}

What it means

Thrown inside the anonymous DexStmtNode's accept() when re-visiting a 31t-format instruction (fill-array-data / switch): findLabelIndex(label) scanned the already-collected needCareStmts and no DexLabelStmtNode with a matching label exists. It means the label referenced by the smali instruction was never defined (or was attached to a different code body), so the branch/in payload target cannot be resolved.

Solutions

  1. Check the smali source for a label declaration that matches the referenced label name and add the missing ':label' line
  2. If the label is intentionally absent (dead payload), replace the 31t instruction with a nop or drop the statement before visiting
  3. Ensure label objects are shared between the jump instruction and its DexLabelStmtNode so findLabelIndex can match by identity
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at d2j-smali/src/main/java/com/googlecode/d2j/smali/SmaliCodeVisitor.java:177 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08). Data as JSON: /api/errors/64c636aab17d6f9c. Report an issue: GitHub.

Appendix: source

Thrown at d2j-smali/src/main/java/com/googlecode/d2j/smali/SmaliCodeVisitor.java:177

            DexStmtNode s = needCareStmts.get(i);
            if (s instanceof DexLabelStmtNode) {
                DexLabelStmtNode ss = (DexLabelStmtNode) s;
                if (ss.label == label) {
                    labelIndex = i;
                }
            }
        }
        return labelIndex;
    }

    /* package */void visitF31tStmt(final Op op, final int reg, final DexLabel label) {
        add(new DexStmtNode(op) {

            @Override
            public void accept(DexCodeVisitor cv) {
                int labelIndex = findLabelIndex(label);
                if (labelIndex < 0 || labelIndex >= needCareStmts.size()) {
                    throw new RuntimeException("can't find label for " + op + " " + label);
                }

                switch (op) {
                case PACKED_SWITCH:
                    PackedSwitchStmt packedSwitchStmt = (PackedSwitchStmt) needCareStmts.get(labelIndex + 1);
                    cv.visitPackedSwitchStmt(op, reg, packedSwitchStmt.firstCase, packedSwitchStmt.labels);
                    break;
                case SPARSE_SWITCH:
                    SparseSwitchStmt sparseSwitchStmt = (SparseSwitchStmt) needCareStmts.get(labelIndex + 1);
                    cv.visitSparseSwitchStmt(op, reg, sparseSwitchStmt.cases, sparseSwitchStmt.labels);
                    break;
                case FILL_ARRAY_DATA:
                    ArrayDataStmt arrayDataStmt = (ArrayDataStmt) needCareStmts.get(labelIndex + 1);
                    Object v;
                    byte[] vs = arrayDataStmt.objs;
                    switch (arrayDataStmt.length) {
                    case 1: {
                        v = vs;

View on GitHub (pinned to b5bda4fb49)